注册 登录
编程论坛 ASP技术论坛

我经常使用的分页代码

riyou2009 发布于 2014-01-17 23:47, 671 次点击
我经常使用的分页代码,供大家参考

<%
   set rs=server.CreateObject("adodb.recordset")
   sql=" select * from book order by id desc"
   rs.open sql ,conn,1,1
               
    if rs.eof and rs.bof then
                response.Write("没有记录")
    else
        num=15
        rs.PageSize=num
        pages=rs.PageCount
        if curpage="" or not isNumeric(curpage) then
        curpage=1
        end if
        if curpage<1 then
        curpage=1
        end if

        rs.absolutepage=curpage
    end if
%>
                  


        <%if pages>0 then%>
        <a href="http://www.首页</a>|<%end if%>
        <%if curpage>=2 then%>
        <a href="http://www.上页</a>|<%end if%>
        <%if curpage+1<pages then%>
        <a href="http://www.下页</a> |<%end if%>
        <%if pages>=1 then%>
        <a href="http://www.尾页</a><%end if%>
    &nbsp;页数:<%response.write curpage&"/"&pages%>

         <%
         rs.close
         set rs=nothing
         %>
2 回复
#2
hu9jj2014-01-18 19:46
有什么特别之处吗?
#3
亲吻三下2014-03-10 10:14
路过而已
1