以下代码中,“下一页”到最后一页还是显示,并继续+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> " 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>