本站为一个技术型PHP个人门户站,提供一些代码,技术文章、免费空间消息信息、让学习编程更轻松和不要钱买空间更方便-PHP小戴
你当前的位置:首页>>建站代码>>asp代码

分页ASP代码带跳转页功能

  • 这分页功能:上下分页,尾页首页转到第几页,个这个分页带有下拉框分页还不错!!!

    以下是代码片段:

    <!-- #include file="conn.asp" -->'连接字符....数据连接。
    <%
    dim i,intPage,page,pre,last,filepath
    set rs = server.CreateObject("adodb.recordset")
    sql="select * from user order by user_ID desc"
    rs.PageSize = 20 '这里是设定每页显示的记录数
    rs.CursorLocation = 3
    rs.Open sql,conn,0,2,1 '这里是执行你查询SQL并获得结果记录集
    pre = true
    last = true
    page = trim(Request.QueryString("page"))'取的分页数据。并去掉空格
    '下面开始判断
    if len(page) = 0 then
    intpage = 1
    pre = false
    else
    if cint(page) =< 1 then
    intpage = 1
    pre = false
    else
    if cint(page) >= rs.PageCount then
    intpage = rs.PageCount
    last = false
    else
    intpage = cint(page)
    end if
    end if
    end if
    if not rs.eof then
    rs.AbsolutePage = intpage
    end if
    %>
    循环开始:
    <%
    for i=1 to rs.PageSize
    if rs.EOF or rs.BOF then exit for
    %>
    ..................
    ..................
    这里就可以绑定数据了::::这个大家都会。。。。。 
    ...................
    <%
    rs.movenext
    next
    %>
    循环结束

    调用分页显示部分:
    <table width="99%" border="1" cellpadding="2" cellspacing="2" borderColorLight=#808080 borderColorDark=#ffffff>
    <tr>
    <%if rs.pagecount > 0 then%>
    <td width="13%" align="left">当前页<%=intpage%>/<%=rs.PageCount%></td>
    <%else%>
    <td width="41%" align="left">当前页0/0</td><%end if%>
    <td width="46%" align="right"> <a href="document_manage.asp?page=1">首页</a>|
    <%if pre then%>
    <a href="document_manage.asp?page=<%=intpage -1%>">上页</a>| <%end if%>
    <%if last then%>
    <a href="document_manage.asp?page=<%=intpage +1%>">下页</a> |<%end if%>
    <a href="document_manage.asp?page=<%=rs.PageCount%>">尾页</a>|转到第
    <select name="sel_page" onchange="javascript:location=this.options[this.selectedIndex].value;">
    <%
    for i = 1 to rs.PageCount
    if i = intpage then%>
    <option value="document_manage.asp?page=<%=i%>" selected><%=i%></option>
    <%else%>
    <option value="document_manage.asp?page=<%=i%>"><%=i%></option>
    <%
    end if
    next
    %>
    </select>页</font>
    </td>
    </tr>
    </table>

    OK。。。。。小戴编程技术门户


     


  • [时间:2009-02-04 15:58:35][点击:]

  • 上下篇文章加载中...
本站关键字:宁波网络公司/宁波网站建设公司/宁波网站制作公司/宁波做网站公司