以下为公用代码,必须具备。


<%filepath=request.servervariables("path_info")%>
<%page=1 '设置变量初始值PAGE=1
page=request.querystring("page") 'page值为接受值
rs.PageSize = 20 '每页显示记录数
if Not IsEmpty(trim(Request("Page"))) then '如果PAGE已经初始化...
Page = CInt(Request("Page")) '接收PAGE并化为数字型赋给PAGE变量
if Page > rs.PageCount then '如果接收的页数大于总页数
rs.AbsolutePage = rs.PageCount '设置当前显示页等于最后页
elseif Page <= 0 then '如果page小于等于0
Page = 1 '设置PAGE等于第一页
else
rs.AbsolutePage = Page '如果大于零,显示当前页等于接收的页数
end if
End if
Page = rs.AbsolutePage%>





第一种分页


<%if rs.pagecount<>1 and rs.pagecount<>0 then%>
<%if page>1 then%>
<%if page [首页]
[上一页]
[下一页]
[尾页]
<%else%>
[首页]
[上一页]
[下一页] [尾页]
<% end if %>
<%else%>
[首页] [上一页]
[下一页]
[尾页]
<%end if %>
<%else%>
[首页] [上一页] [下一页] [尾页]
<%end if%>




第二种分页


<%if rs.pagecount<>1 and rs.pagecount<>0 then%>
<%if page>1 then%>
[首页]
[上一页]
<%if page [下一页]
[尾页]
<%else%>
[下一页] [尾页]
<% end if %>
<%else%>
[首页] [上一页]
[下一页]
[尾页]
<%end if %>
<%else%>
[首页] [上一页] [下一页] [尾页]
<%end if%>




第三种


<%if rs.pagecount<>1 and rs.pagecount<>0 then%>
<%if page <%if page=1 then %>
[首页] [上一页]
<%else%>
[首页]
[上一页]
<% end if %>
[下一页]
[尾页]
<%else%>
[首页]
[上一页]
[下一页] [尾页]
<%end if %>
<%else%>
[首页] [上一页] [下一页] [尾页]
<%end if%>




最后信息


[页次:<%=page%>/<%=rs.PageCount%>]
[共<%=rs.RecordCount%>篇 <%=rs.PageSize%>篇/页]
转到



补充:


<%
dscao=0
DO WHILE NOT dscao = rs.PageCount %>
<% dscao=dscao+1
loop
%>

  <%
dim n,k
if (totalPut mod MaxPerPage)=0 then 'n表示总页数
n= totalPut \ MaxPerPage
else
n= totalPut \ MaxPerPage + 1
end if
k=currentPage
if k<>1 then
response.write "["+"首页] "
response.write "["+"上一页] "
else
Response.Write "[首页] [上一页]"
end if
if k<>n then
response.write "["+"下一页] "
response.write "["+"尾页] "
else
Response.Write "[下一页] [尾页]"
end if
'------------------------------------------------------页面跳转