我实现的总是转不到另外一页,只能在第一页现实,怎么点"下一页"或"最后一页"都在第一页现实!!!
求救啊!!!!!!!!!!!!!!
我把代码给你们 你们帮我看看哪儿错了 为什么点击第二页 未页 的时候 总是显示第一页的内容????
如果错了的 你们把错的地方给我指出来
如果觉得这样的代码麻烦的话 能不能帮我写个简单点的代码????
&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&&上边还有一些联数据库啊什么的代码 就不写出来了
<div align="center">
<%'开始分页
Const MaxPerPage=10
dim totalPut
dim CurrentPage
dim TotalPages
dim j
dim sql
if Not isempty(request("page")) then
currentPage=Cint(request("page"))
else
currentPage=1
end if
set rs=server.createobject("adodb.recordset")
rs.open "select name,dianhua,dizhi,lianxiren,chanpin from chanpin",conn,1,1
if err.number<>0 then
response.write "数据库中无数据"
end if
if rs.eof And rs.bof then
Response.Write "<p align='center' class='contents'> 您还没有添加新闻!</p>"
else
totalPut=rs.recordcount
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if
if currentPage=1 then
showContent
showpage totalput,MaxPerPage,"index.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showContent
showpage totalput,MaxPerPage,"index.asp"
else
urrentPage=1
showContent
showpage totalput,MaxPerPage,"index.asp"
end if
end if
end if
sub showContent
dim i
i=0
%>
<table border="0" width="760" height="30" bgcolor="#99ccff">
<form name="form1" method="post" action="index.asp?action=del">
<tr height="20">
<td width="100" bgcolor="#F7F7F7"> <div align="center">产品名称</div></td>
<td width="100" bgcolor="#F7F7F7"> <div align="center">电话</div></td>
<td width="100" bgcolor="#F7F7F7"> <div align="center">地址</div></td>
<td width="100" bgcolor="#F7F7F7"> <div align="center">联系人</div></td>
<td bgcolor="#F7F7F7"> <div align="center">产品</div></td>
</tr>
<%set rs=server.createobject("adodb.recordset")
sql="select * from chanpin"
rs.open sql,conn,1,1
do while not rs.eof
%>
<tr height="25">
<td bgcolor="#F7F7F7" width="100" ><%=rs("name")%></td>
<td bgcolor="#F7F7F7"width="100" ><%=rs("dianhua")%></td>
<td bgcolor="#F7F7F7"width="100" ><%=rs("dizhi")%></td>
<td bgcolor="#F7F7F7"width="100" ><%=rs("lianxiren")%></td>
<td bgcolor="#F7F7F7"><%=rs("chanpin")%></td>
</tr>
<%i=i+1
if i>=MaxPerPage then Exit Do
rs.movenext
loop
rs.close
set rs=nothing
%>
</form>
</table>
</div>
<%end sub
Function showpage(totalnumber,maxperpage,filename)
Dim n
If totalnumber Mod maxperpage=0 Then
n= totalnumber \ maxperpage
Else
n= totalnumber \ maxperpage+1
End If
Response.Write "<form method=Post action="&filename&">"
Response.Write "<p align='center' class='contents'> "
If CurrentPage<2 Then
Response.Write "<font class='contents'>首页 上一页</font> "
Else
Response.Write "<a href="&filename&"?page=1 class='contents'>首页</a> "
Response.Write "<a href="&filename&"?page="&CurrentPage-1&" class='contents'>上一页</a> "
End If
If n-currentpage<1 Then
Response.Write "<font class='contents'>下一页 尾页</font>"
Else
Response.Write "<a href="&filename&"?page="&(CurrentPage+1)&" class='contents'>"
Response.Write "下一页</a> <a href="&filename&"?page="&n&" class='contents'>尾页</a>"
End If
Response.Write "<font class='contents'> 页次:</font><font class='contents'>"&CurrentPage&"</font><font class='contents'>/"&n&"页</font> "
Response.Write "<font class='contents'> 共有</font>"&totalnumber&"条新闻 "
Response.Write "<font class='contents'>转到:</font><input type='text' name='page' size=2 maxlength=10 class=smallInput value="¤tpage&">"
Response.Write " <input type='submit' class='button' value='GO' name='cndok'></form>"
&&&&&&&&&&&&&&&&&&&&
求助啊~~~~~~~~~~~~~~~~~~~~~~~~