标题: 这个是不是分页问题? [打印本页] 作者: lala 时间: 2010-1-11 03:10 标题: 这个是不是分页问题? <!--#include file="conn.asp"-->
<!--#include file="config.asp"-->
<%
dim catid,i,strcat
catid=SafeRequest("catid",1)
CatList =catid
PID = catid
if catid="" or catid = 0 then
conn.close
set conn = Nothing
response.Redirect "procat.asp"
response.end
end if
set rs=server.CreateObject("adodb.recordset")
do while not PID = 0
rs.open "Select categoryid,category,ParentID From category Where categoryid="&PID,conn,1,1
if rs.eof and rs.bof then
response.Write "<script LANGUAGE='javascript'>alert('您输入的参数非法,请正确操作!');history.go(-1);</script>"
rs.close
set rs = Nothing
conn.Close
set conn=nothing
response.end
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,"cat.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showContent
showpage totalput,MaxPerPage,"cat.asp"
else
currentPage=1
showContent
showpage totalput,MaxPerPage,"cat.asp"
end if
end if
end if
sub showContent
dim i
i=0
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><TABLE WIDTH="286" HEIGHT="120" BORDER="0" align="center" CELLPADDING="0" CELLSPACING="0">
<%do while not rs.eof%>
<TR>
<TD height="120" colspan="2" align="center" ><a href=product.asp?id=<% = rs("id") %> target="_blank">
<%
if trim(rs("pic"))<>"" then %>
<img src=<% = trim(rs("pic"))%> border=0 width="<% = webimg9 %>" height="<% = webimg10 %>">
<% else %>
<img src=images/emptybook.jpg border=0 width="<% = webimg9 %>" height="<% = webimg10 %>">
<% end if %>
</a>
<div align="center"><A href=product.asp?id=<%=rs("id")%>><font color="#FF6600"><%=trim(rs("name"))%></font></A></div></TD>
<TD width="12" align="center" > </TD>
<%i=i+1
if i>=MaxPerPage then Exit Do
rs.movenext%>
<TD width="97" height="120" align="center" ><a href=product.asp?id=<% = rs("id") %> target="_blank">
<% if trim(rs("pic"))<>"" then %>
<img src=<% = trim(rs("pic"))%> border=0 width="<% = webimg9 %>" height="<% = webimg10 %>">
<% else %>
<img src=images/emptybook.jpg border=0 width="<% = webimg9 %>" height="<% = webimg10 %>">
<% end if %>
</a>
<div align="center"><A href=product.asp?id=<%=rs("id")%>><font color="#FF6600"><%=trim(rs("name"))%></font></A></div></TD>
<TD width="12" height="120" align="center" > </TD>
<%i=i+1
if i>=MaxPerPage then Exit Do
rs.movenext%>
<TD height="120" width="72" colspan="2" align="center" ><a href=product.asp?id=<% = rs("id") %> target="_blank">
<% if trim(rs("pic"))<>"" then %>
<img src=<% = trim(rs("pic"))%> border=0 width="<% = webimg9 %>" height="<% = webimg10 %>">
<% else %>
<img src=images/emptybook.jpg border=0 width="<% = webimg9 %>" height="<% = webimg10 %>">
<% end if %>
</a>
<div align="center"><A href=product.asp?id=<%=rs("id")%>><font color="#FF6600"><%=trim(rs("name"))%></font></A></div></TD>
<%i=i+1
if i>=MaxPerPage then Exit Do
rs.movenext%>
</TR>
<%
loop
rs.close
set rs=nothing
%>
</TABLE></td>
</tr>
</table>
<%
End Sub
Function showpage(totalnumber,maxperpage,filename)
Dim n