分页的问题帮忙改一下代码!谢谢
<!--#include file="conn.asp"-->
<%
dim currentpage,page_count,Pcount
dim totalrec,endpage
currentPage=request("page")
if currentpage="" then
currentpage=1
else
currentpage=clng(currentpage)
if err then
currentpage=1
err.clear
end if
end if
Productid=session("Productid")
if request("Productnub") = "" then
set rs=Server.CreateObject("ADODB.RecordSet")
rs.open "Select * from Product where RoomID='"&session("Productid")&"' order by id desc",conn,1,3
else
Productid = request("Productnub")
set rs=Server.CreateObject("ADODB.RecordSet")
rs.open "Select * from Product where RoomID='"& Productid &"' order by id desc",conn,1,3
end if
%>
<html>
<head>
<meta http-equiv="Content-Language" c>
<meta http-equiv="Content-Type" c>
<title>产品展示</title>
<style type="text/css">
<!--
body { font-size: 9pt}
table { font-size: 9pt}
.c1 { font-size: 10.5pt}
a { text-decoration: none; font-size: 9pt}
a:visited { color: #0000FF; text-decoration: none; }
a:hover { color: #FF0033; text-decoration: none; }
-->
</style>
</head>
<body bgcolor="#F7F7F7">
<div align="center">
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td width="200%"> </td>
</tr>
</table>
</div>
<div align="center">
<center>
<table width="100%" height="212" border="0" cellpadding="3" cellspacing="0">
<% if rs.eof then %>
<tr>
<td> 对不起,现在没有图像数据!</td>
</tr>
<%
else
rs.PageSize = Cint(4)
rs.AbsolutePage=currentpage
page_count = 0
totalrec = rs.recordcount
while (not rs.eof) and (not page_count = Cint(4))
%>
<tr>
<%
js1 = 0
do while js1 < 4
dim id
id = rs("ID")
%>
<td align="center"> <table width="150" height="130" cellspacing="1" bgcolor="#E4E4E4" style="table-layout:fixed "> <tr>
<a href="#" ><td height="100" bgcolor="#F7F7F7" style="cursor:hand"><div align="center"><img border="0" src="<%=rs("IconURL")%>"></div></td></a>
</tr>
</table>
<table width="150" border="0" cellpadding="0" cellspacing="1" bgcolor="#E4E4E4">
<tr>
<td width="70" align="center">名称:<%=rs("Name")%></td>
<td width="77" align="center">价格:<%=rs("Price")%></td>
</tr>
</table></td>
<%
rs.movenext
if rs.eof then
exit do
end if
js1 = js1 + 1
loop
%>
</tr>
<%
wend
Pcount = rs.PageCount
%>
<td height="24" colspan="6"> <table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td align="center">分页:
<%
if currentpage > 4 then
response.write "<a href=""?page=1&roomnub="&roomid&""">[1]</a> ..."
end if
if Pcount>currentpage+3 then
endpage=currentpage+3
else
endpage=Pcount
end if
for i=currentpage-3 to endpage
if not i<1 then
if i = clng(currentpage) then
response.write " <font color=red>["&i&"]</font>"
else
response.write " <a href=""?page="&i&"&roomnub="&roomid&""">["&i&"]</a>"
end if
end if
next
if currentpage+3 < Pcount then
response.write "... <a href=""?page="&Pcount&"&roomnub="&roomid&""">["&Pcount&"]</a>"
end if
%> </td>
</tr>
</table></td>
</tr>
</table>
</center>
</div>
</body>
</html>
<%
rs.close
conn.close
end if
%>
|