找回密码
 注册
搜索
热搜: java php web
查看: 210|回复: 0

关于分页程序的代码

[复制链接]
发表于 2009-10-18 10:05:48 | 显示全部楼层 |阅读模式
<%
set rs    =    server.createobject("adodb.recordset")
   sql ="select * from userinfo order by id desc"     
   rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "<tr><td align=center>暂无记录!</td></tr>"

else
shownum=30    '每页显示的数
totalrecord=rs.recordcount
rs.pagesize=shownum
maxpage=rs.pagecount
requestpage=clng(request.querystring("page"))
if requestpage="" or requestpage=0 then
requestpage=1
end if
if resquestpage>maxpage then
resquestpage=maxpage
end if
if not requestpage=1 then
rs.move (requestpage-1)*rs.pagesize
end if
for i=1 to rs.pagesize and not rs.bof%>
  
'这里面放循环内容

<%
rs.movenext
if rs.eof then exit for
next
end if
%>



<%
if requestpage-1 mod 10=0 then
p=(requestpage-1) \ 10
else
p=(requestpage-1) \ 10
end if
if requestpage=1 then
response.write "<font face=webdings color=""#FF0000"">9</font>&nbsp;"
else
response.write "<a href=?page=1 title=首页><font face=webdings>9</font></a>&nbsp;"
end if
if p*10>0 then response.write "<a href=?page="&p*10&" title=上一页><font face=webdings>7</font></a>&nbsp;"
response.write "<b>"
for ii=p*10+1 to P*10+10
if ii=requestpage then
response.write "<font color=""#FF0000"">"&ii&"</font>&nbsp; "
else
response.write "<a href=?page="&ii&">"&ii&"</a>&nbsp; "
end if
if ii=maxpage then exit for
next
response.write "</b>"
if ii<maxpage then response.write "<a href=?page="&ii&" title=下一页><font
face=webdings>8</font></a>&nbsp;"
if requestpage=maxpage then
response.write "<font face=webdings color=""#FF0000"">:</font>&nbsp;"
else
response.write "<a href=?page="&maxpage&" title=尾页><font face=webdings>:</font></a>&nbsp;"
end if
response.write" 共有"&maxpage&"页&nbsp; 共"&totalrecord&"个用户 &nbsp;每页"&shownum&"个用户"
%>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|软晨网(RuanChen.com)

GMT+8, 2024-11-22 21:00

Powered by Discuz! X3.5

Copyright © 2001-2023 Tencent Cloud.

快速回复 返回顶部 返回列表