zoukankan      html  css  js  c++  java
  • 一个单词查询程序

     

    <html>
    <hea>
    <title>Words list</title>
    <STYLE TYPE="text/css">
     <!-- 
    /* $WEFT -- Created by: Alex (hezhengyu@bit.edu.cn) on 2004-6-14 -- */
      @font-face 
    {
        font-family
    : HMPhone BDC;
        font-style
    :  normal;
        font-weight
    : normal;
        src
    : url(HMPHONE0.eot);
      
    }

    -->
        body 
    {
            font-family
    : "Tahoma";
        
    }

    </STYLE>
    </head>
    <body>
    <form action="find.asp" id=form1 name=form1>
    <input name="name" maxlength="15" size=15>
    <input type="submit" value="Find it" name="find">
    </form>

    <%
    sql
    =""
    name=request("name")
    sql
    ="select * from words where word like '%"&name&"%'"
    set rs=server.createobject("adodb.recordset")
    conn 
    = "DBQ="&server.mappath("word.mdb")&";Driver={Microsoft Access Driver (*.mdb)};DriverId=25;FIL=MS Access;"
    rs.open sql,conn,1,1
    maxperpage
    =30
    rs.pagesize
    =maxperpage
    if trim(request("page"))<>"" and isnumeric(request("page")) then
        currentpage
    =clng(request("page"))
        
    if currentpage<1 then
            currentpage
    =1
        
    elseif currentpage>rs.pagecount then
            currentpage
    =rs.pagecount
        
    end if
    else
        currentpage
    =1
    end if
    if rs.eof then
        response.write 
    "<p align='center'>没有这个单词</p>"
    else
        totalput
    =rs.recordcount'记录
        if currentpage=1 then
            showpages
            showcontent
        
    else
            
    if (currentpage-1)*maxperpage<totalput then
                rs.move(currentpage
    -1)*maxperpage
                
    dim bookmark
                bookmark
    =rs.bookmark'移动至开始显示的记录位置
                showpages
                showcontent
            
    else
                currentpage
    =1
                showcontent
            
    end if
        
    end if
        rs.close
    end if
    set rs=nothing
    set conn=nothing

    sub showcontent
    dim i
    i
    =0
    do while not (rs.eof or err)
    result
    =replace(rs("word"),name,"<font color=black>"&name&"</font>")
    response.write rs(
    "id")&"&nbsp;&nbsp;&nbsp;<font color=red><b>"&result&"</b></font>"&"&nbsp;&nbsp;&nbsp;[<font face=""HMPhone BDC"">"&rs("phonetic")&"</font>]&nbsp;&nbsp;&nbsp;<font color=blue face=""隶书""><b>"&rs("remark")&"</b></font><br>"
    i=i+1
    if i>=maxperpage then exit do
        rs.movenext
    loop
    end sub

    sub showpages()
         
    dim n,k
        
    if(totalput mod maxperpage)=0 then
            n
    =totalput/maxperpage
        
    else
            n
    =int(totalput/maxperpage)+1
        
    end if
    %>
    Total 
    <%=rs.recordcount%> words. 
    <%k=currentpage
    if k=1 then
        response.write 
    "First page Previous "
    else
        response.write 
    "<b><a href=find.asp?name="&name&"&page=1>First page</a></b> "
        response.write "<b><a href=find.asp?name="&name&"&page="&k-1&">Previous</a></b> "
    end if
    if k=then
        response.write 
    " Next Last page<br>"
    else
        response.write 
    " <b><a href=find.asp?name="&name&"&page="&k+1&">Next</a></b> "
        response.write "<b><a href=find.asp?name="&name&"&page="&n&">Last page</a></b><br>"
    end if
    end sub
    %>
    </body>

    </html>

    演示地址http://www.hzsghj.gov.cn/g7/data/find.asp
  • 相关阅读:
    微信转发或分享朋友圈带缩略图、标题和描述的实现方法
    apache一个IP多个站点的配置方法
    微信网页扫码登录的实现
    laravel take(3) 读取最近三条信息
    微信卡劵、微信卡包,必须是认证订阅号或认证服务号
    CSS3 去除苹果浏览器按钮input[type="submit"]和input[type="reset"]的默认样式
    使用laravel5.4结合easywechat进行微信开发--基本配置
    Class 'QrCode' not found ? 和 laravel 生成二维码接口(Simple QrCod)
    windows redis的启动 和 Laravel中Redis的使用
    改变checkbox的默认样式
  • 原文地址:https://www.cnblogs.com/Glory/p/23216.html
Copyright © 2011-2022 走看看