Page=cint(request("page"))
else
 Page=1
end ifdim i
i=0
rs.mo">

ASP分页函数

80酷酷网    80kuku.com

  分页|函数

const MaxPerPage=18
dim page
if not request("page")="" then
 Page=cint(request("page"))
else
 Page=1
end if

dim i
i=0
rs.move (Page-1)*MaxPerPage

分页
do while
 ' 中间是循环段
 i=i+1
 if i>=MaxPerPage then exit do
 rs.movenext
loop

===========================
totalnumber = 记录总数
maxperpage = 每页记录数
filename = 分页的文件名
<%
function showpage(totalnumber,maxperpage,filename)
dim n
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end if
response.write "<form method=Post action="&filename&">"
response.write "<p align='center'><font color='#000080'>>>分页</font> "
if page<2 then
response.write "<font color='#000080'>首页 上一页</font> "
else
response.write "<a href="&filename&"?page=1&>首页</a> "
response.write "<a href="&filename&"?page="&page-1&">上一页</a> "
end if
if n-page<1 then
response.write "<font color='#000080'>下一页 尾页</font>"
else
response.write "<a href="&filename&"?page="&(page+1)
response.write ">下一页</a> <a href="&filename&"?page="&n&">尾页</a>"
end if
response.write "<font color='#000080'> 页次:</font><strong><font color=red>"&page&"</font><font color='#000080'>/"&n&"</strong>页</font> "
response.write "<font color='#000080'> 共<b>"&totalnumber&"</b>条记录 <b>"&maxperpage&"</b>条记录/页</font> "
response.write " <font color='#000080'>转到:</font><input type='text' name='page' size=4 value="&page&">"
response.write "<input type=submit name=Submit value=go> </span></p>"

end function
%>

分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: