我的分页代码出问题,连接上一页,下一页的都无法显示。请大家帮帮我把!!!!谢谢 <html> <head><title>留言</title></head> <body> <form action="liuyan1.asp" method=post> <table> <tr> <td>姓名</td><td><input type="text" name=xm></td> </tr> <tr> <td>留言 </td><td><input type="text" name=ly></td> <td><input type="hidden" name=cur value=0></td> </tr> <tr><td><input type="submit" name=cmd1 value=发送> </td> <td><input type="reset" name=cmd2 value=取消> </td> </tr> </table> </body> </html> -------------------------------------------------------------------------------------------- <%name=request("xm") liuyan=request("ly") conn= "DBQ=" + server.mappath("qiye.mdb") + ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};" set cn=server.createobject("ADODB.CONNECTION") cn.open conn sql1="insert into lyb(xm,ly) values ('"&name&"','"&liuyan&"')" cn.execute(sql1) %> <html><head></head> <body> <% dim allpage,allrec dim curpage,every,y,currec set rs=server.createobject("adodb.recordset") sql="select * from lyb order by id desc" rs.open sql,cn,1,1 rs.movelast allrec=rs.recordcount recount=rs.fields.count-1 every=8
if request("cur")=0 then curpage=1 else curpage=cint(request("cur")) end if
for i=0 to cint((allrec-1)/every)+1 y=allrec-every*i if y<=8 then exit for end if next if y<=8 and y>=5 then allpage=cint(allrec/every) else allpage=cint((allrec-1)/every)+1 end if
if curpage=allpage then currec=allrec-(allpage-1)*every else currec=every end if
rs.movefirst rs.move (curpage-1)*every
if rs.bof and rs.eof then else%> <table border=1 width=100% cellPadding=0 cellSpacing=0> <tr> <%for i=1 to recount+1%> <%if i=recount+1 then%> <td>操作 </td> <%else%> <td><%=rs(i).name%></td> <%end if%> <%next%> </tr> <%for i=1 to every %> <tr> <%for j=1 to recount+1 if j=recount+1 then%> <td>del</td> <%else%> <td><%=rs(j)%></td> <%end if%> <%next%> </tr> <%rs.movenext if rs.eof then exit for end if%>
<%next%>
</table> <%end if%> <font size=2> <% response.write "第<font color=red>"+cstr(curpage)+"</font>页/共<font color=red>" response.write cstr(allpage)+"</font>页" response.write ",本页<font color=red>"+cstr(currec)+"</font>条/共<font color=red>" response.write cstr(allrec)+"</font>条 " %> </font> <%if curpage<>1 then%> <a href="liuyan1.asp?cur=1">第一页</a> <a href="liuyan1.asp?cur=<%=allpage%>">最后一页</a> <%end if%> <%if curpage<>allpage then%> <a href="liuyan1.asp?cur=<%=curpage-1 %>">上一页</a> <a href="liuyan1.asp?cur=<%=curpage+1 %>">下一页</a> <a href="liuyan1.asp?cur=<%=allpage %>">最后一页</a> <%end if%> <% rs.close set rs=nothing cn.close set cn=nothing %> </body> </html>