找回密码
 注册
搜索
热搜: 回贴
  • 前程无忧官网首页 有什么好的平台可以
  • 最新的销售平台 互联网营销的平台有哪
  • 制作网页的基本流程 网页制作和网页设
  • 【帝国CMS】输出带序号的列表(数字排
  • 网站建设公司 三一,中联,极东泵车的
  • 织梦 建站 织梦网站模版后台怎么更改
  • 云服务官网 哪些网站有免费的简历模板
  • 如何建网站要什么条件 建网站要用什么
  • 吉林市移动公司电话 吉林省退休人员网
  • 设计类毕业论文 网站设计与实现毕业论
查看: 118|回复: 5

[求助]分页问题。。。。。谢谢

[复制链接]
发表于 2010-1-7 02:23:03 | 显示全部楼层 |阅读模式 IP:江苏扬州
以下代码中,“下一页”到最后一页还是显示,并继续+1
对应的页没去掉超连接。。。。
问题在哪里?谢谢~~~
<!--#include file="conn.asp"--><head> <meta http-equiv="Content-Language" content="zh-cn"> <style type="text/css"> <!-- td { font-size: 12px; } --> </style> </head>
<% sql="select * from read1 order by id desc" set rs=server.createobject("adodb.recordset") rs.open sql,conn,1,1 if rs.recordcount=0 then 'rs.recordcount 所有记录数' response.write("数据库没有相关信息") else pgsz=2 pgct=4 rs.pagesize=cint(pgsz) totel=rs.recordcount pagecount=int(totel/pgsz*-1)*-1 pageno=request("pageno") 'pageno为当前页 if pageno="" then pageno=1 end if end if %> <% if (pageno-1)*pgsz<totel then rs.move pgsz*(pageno-1) '指针移到pgsz*(pageno-1)记录上 end if %> <% dim i i=0 do while not rs.eof and i<pgsz i=i+1 %>
<table cellpadding="0" cellspacing="0" width="770" height="31"> <!-- MSTableType="layout" --> <tr> <td width="279" valign="middle" bgcolor="#00FFFF"> 书名:<%=rs("name")%></td> <td width="54"> 出版社:</td> <td width="159"> 出版时间:</td> <td width="140"> 类别:</td> <td height="29" width="136"> 价钱:</td> </tr> </table>
<%rs.movenext loop %> </div>
<div align="center"> <table cellpadding="0" cellspacing="0" width="770" height="20"> <!-- MSTableType="layout" --> <tr> <td valign="top" height="20" width="770"><a href="index2_fenye.asp?pageno=1"> <span style="text-decoration: none">第一页</span></a>| <% if pagecount>1 then '前六页 a=int(pageno/pgct*-1)*-1 if a>1 then response.write "<a href=index2_fenye.asp?pageno=" response.write (a-1)*pgct response.write "><<<</a>| " end if num=0 i=(a-1)*pgct+1 while i<=pagecount and num<pgct if i=pageno then response.write i & " " else response.write "<a href=index2_fenye.asp?pageno=" response.write i response.write ">" response.write i response.write"</a> " end if i=i+1 num=num+1 wend
'下六页 if a*pgct<pagecount then response.write " |<a href=index2_fenye.asp?pageno=" response.write a*pgct+1 response.write ">>>></a> |" end if if pageno<pagecount then response.write "<a href=index2_fenye.asp?pageno="&pageno+1&"><span style='text-decoration: none'>下一页</span></a>&nbsp;" response.write "<a href=index2_fenye.asp?pageno=" response.write pagecount response.write "><span style='text-decoration: none'>最后一页</span></a>" end if end if %>
<% rs.close set rs=nothing %> <% conn.close %></td> </tr> </table> </div>
发表于 2010-1-7 02:23:09 | 显示全部楼层 IP:江苏扬州
if i=pageno then response.write i & " " 你的pagecount是总页数把?
if i=pagecount then response.write i & " "
回复

使用道具 举报

发表于 2010-1-7 02:23:12 | 显示全部楼层 IP:江苏扬州
当下一页时,现比较这个页加1后是不是大于总页数,如果大于总页数,就不要加1了,如果不大于,就显示页数
回复

使用道具 举报

发表于 2010-1-7 02:23:15 | 显示全部楼层 IP:江苏扬州
红色的那行字,缺少对象吧,我以前写成的是recordeset.count,可以使用
回复

使用道具 举报

发表于 2010-1-7 02:23:18 | 显示全部楼层 IP:江苏扬州
谢谢
还有一个呢?
if i=pageno then response.write i & " "
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|小黑屋|最新主题|手机版|微赢网络技术论坛 ( 苏ICP备08020429号 )

GMT+8, 2024-9-30 07:25 , Processed in 0.200904 second(s), 12 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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