关于分页问题

etononline 2004-12-30 11:19:37
怎么限制页面分页数为一排只能出现10个页面的按钮

就像CSDN论坛一样。下面只能出现1-11个页面按钮。
...全文
87 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
fangq 2004-12-30
  • 打赏
  • 举报
回复
一套完整的分页程序

page=1
rs.pagesize=22
if not isempty(request("page")) then
page=cint(request("page"))
if page>rs.pagecount then
rs.absolutepage=rs.pagecount
elseif page<=0 then
page=1
else
rs.absolutepage=page
end if
end if
do while not rs.eof and m<=rs.pagesize

n=n+1
if n mod 2=0 then
bg="#d1d1d1"
else
bg="#ececec"
end if
%>
<table width="100%" border="0" cellspacing="0">
<tr bgcolor="<%=bg%>">
<td width="10%"><div align="center"><span class="fq"><a href="adm_dp.asp?id=dp_cz&dd=<%=rs("id")%>"><%=rs("id")%></a></span></div></td>
<td width="23%"><div align="left">
<%if rs("cz_yn")=true then pianming=("<font color='red'><strike>"&rs("pianming")&"</strike></font>") else pianming=rs("pianming") end if%>
<%=pianming%></div></td>
<td width="21%" height="20"><div align="left"><%=rs("zuyan")%></div></td>
<td width="16%"><div align="center"><%=rs("suoshu")%></div></td>
<td width="8%"><div align="center"><span class="fq2"><a href="adm_dp.asp?id=dp_edit&dd=<%=rs("id")%>">编辑</a></span></div></td>
<td width="9%"><div align="center"><span class="fq2"><a href="adm_dp.asp?id=dp_del&dd=<%=rs("id")%>">删除</a></span></div></td>
<td width="13%"><div align="center"><%=rs("suoshuren")%></div></td>
</tr>
</table>
<%
m=m+1
rs.movenext
loop%>
<table width="100%" border="0" cellpadding="0">
<tr>
<td><div align="right">
<%if rs.pagecount>1 then %>

<%end if %>
<br>
<%if rs.pagecount<>1 then
if request("dd")="" then
dd=1
else dd=request("dd")
end if
for i=dd to rs.pagecount
'------------------------------------向上翻页-------------------------------------
if i=dd+0 and dd<>1 then response.Write("<a href='adm_dp.asp?id=dp_cx&sel="&request("sel")&"&cx_text="&request("cx_text")&"&page="&i&"&dd="&dd-5&"'>←</a> ")
'------------------------------------向下翻页-------------------------------------
if i>4+dd then
response.Write("<a href='adm_dp.asp?id=dp_cx&sel="&request("sel")&"&cx_text="&request("cx_text")&"&page="&i&"&dd="&i&"'>→</a> ")
exit for
end if
response.write("<a href='adm_dp.asp?id=dp_cx&sel="&request("sel")&"&cx_text="&request("cx_text")&"&page="&i&"&dd="&dd&"'>"&i&"</a> ")
next
else
end if
response.write("<br><br><font color='red'>本次查寻共计:"&bj&"</font>")
end sub%>
peterpansh 2004-12-30
  • 打赏
  • 举报
回复
for i=1 to 10
if i= cint(request.querystring("page_no")) then
color="red"
else
color=""
end if
if rs.pagecount>i then
response.write "<a href='page.asp?page_no=" & i & "><font color='" & color & "'>" & i & "</font></a>"
end if
next
peterpansh 2004-12-30
  • 打赏
  • 举报
回复
for i=1 to 10
if i= cint(request.querystring("page_no")) then
color="red"
end if
if rs.pagecount>i then
response.write "<a href='page.asp?page_no=" & i & "><font color='" & color & "'>" & i & "</font></a>"
end if
next
fog 2004-12-30
  • 打赏
  • 举报
回复
那就取前10个页面所能显示数据的总条数
其它就不取了
etononline 2004-12-30
  • 打赏
  • 举报
回复
顶ing中。。。。。。。。。。。。。。。。。。。。
etononline 2004-12-30
  • 打赏
  • 举报
回复
<!--#include file="conn.asp"-->
<%if not session("checked")="yes" then
response.Redirect "index.asp"
else
%>
<%
on error resume next
exec="select * from user_log order by action_time desc"
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,1,1
rs.PageSize=10
pagecount=rs.PageCount
page=int(request.QueryString ("page"))
if page<=0 then page=1
if request.QueryString("page")="" then
page=1
end if
rs.AbsolutePage=page
%>
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>查询管理</title>
</HEAD>
<BODY topmargin="0" marginwidth="0" leftmargin="0" marginheight="0" rightmargin="0" background="image/gglbg.gif">
<table cellSpacing=0 cellPadding=0 width="731" height="94" >
<tr>
<td width="729" height="92"><img src="image/mani.gif" width="721" height="200"></td>
</tr></table>
<table width="621" height="373" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="621" height="373" background="image/userlz.gif"><table width="618" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="32" height="319"> </td>
<td width="586"><table width="150" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><p> </p>
<table width="539" border="1" cellpadding="0" cellspacing="0" bordercolor="#ffffff" class="av_gofd_but">
<tr bgcolor="#006699">
<td width="140" height="28" align="center">操作时间</td>
<td width="93" align="center">操作人员</td>
<td width="142" align="center">操作人员IP</td>
<td width="154" align="center">活动记录</td>
</tr>
<%for i=1 to rs.PageSize%>
<%if rs.EOF then
exit for
end if%>
<tr bgcolor="F7FBFE">
<td height="30" align="center"><%=rs(1)%></a></td>
<td height="30" align="center"><%=rs(3)%></td>
<td width="142" height="30" align="center"><%=rs(2)%></td>
<td width="154" height="30" align="center"><%=rs(4)%></td>
</tr>
<%rs.movenext
next
%>
</table>
<br>
<%if page=1 and not page=pagecount then%>
第<%=page%>页 <%for i=1 to pagecount%>
<a href="list.asp?page=<%=i%>"><%=i%></a> <%next%><a href="list.asp?page=<%=page+1%>">下一页</a> 
<%elseif page=pagecount and not page=1 then%>
第<%=page%>页 <%for i=1 to pagecount%>
<a href="list.asp?page=<%=i%>"><%=i%></a> <%next%><a href="list.asp?page=<%=page-1%>">上一页</a> 
<%elseif page<1 then%><font color=red>没有用户操作记录!</font>
<%elseif page>pagecount then%><font color=red>没有用户操作记录!</font>
<%elseif page=1 and page=pagecount then%>
<%else%>
第<%=page%>页 <%for i=1 to pagecount%>
<a href="list.asp?page=<%=i%>"><%=i%></a> <%next%><a href="list.asp?page=<%=page-1%>">上一页</a>
<a href="list.asp?page=<%=page+1%>">下一页</a> 
<%end if%>
<%
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
</td>
</tr>
</table>
</td>
</tr>
</table></td>
</tr>
</table>
</BODY>
</HTML>
<%end if%>



这个是我原来的代码,他是一个个的排列下去的。
可是我要实现一排10个页面。按下一页就是11-20页了。


高手帮忙改改。。。。。
etononline 2004-12-30
  • 打赏
  • 举报
回复
我想要10页一组的翻页呀。像动网论坛那样呀。

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧