为什么我的分页不好使,我设的每页只显示三条记录,可是大于三条的时候点上一页、下一页、首页、尾页的时候就会出现找不到网页。而且当记录不足三条的时候也能点上一页,下一页,首页,尾页。这是什么原因呢?大家帮我看一下。谢谢啦!
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="conn.asp"-->
<%
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from classII where id=" & request("id") ,conn,1,1
dim dl
dl=rs("classname")
rs.close
rs.open "select * from Product where classII =" & request("id"),conn,1,1
%>
<%
if rs.eof and rs.bof then
page=1
maxpage=1
else
rs.pagesize=3
icount=rs.recordcount
ipagesize=rs.pagesize
maxpage=rs.pagecount
page=request("page")
if not isnumeric(page) or page="" then
page=1
else
page=cint(page)
end if
if page<1 then
page=1
elseif page>maxpage then
page=maxpage
end if
rs.absolutepage=page
if page=maxpage then
x=iconut-(maxpage-1)*ipagesize
else
x=ipagesize
end if
x=x-4
if page<>1 then
for i=0 to x
rs.movenext
next
end if
end if
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/moban.dwt.asp" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>电脑专卖</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<link href="css.css" rel="stylesheet" type="text/css" />
<!-- InstanceEndEditable -->
</head>
<body>
<table width="1002" height="500" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><img src="img/0001.gif" width="1002" height="209" /></td>
</tr>
<tr>
<td><img src="img/0002.gif" width="1002" height="60" /></td>
</tr>
<tr>
<td height="113" valign="top"><!-- InstanceBeginEditable name="EditRegion3" -->
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="4"> </td>
</tr>
<tr>
<td width="2%"><img src="img/左.gif" width="16" height="300" /></td>
<td width="19%" valign="top"><form id="form1" name="form1" method="post" action="">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><img src="img/1.0" width="194" height="34" /></td>
</tr>
<tr>
<td><img src="img/2.2" width="192" height="52" /></td>
</tr>
<tr>
<td><img src="img/3.1" width="192" height="40" /></td>
</tr>
<tr>
<td><img src="img/4.1" width="192" height="56" /></td>
</tr>
<tr>
<td><img src="img/5.1" width="192" height="43" /></td>
</tr>
<tr>
<td><a href="lxzm.asp"><img src="img/6.1" width="192" height="50" border="0" /></a></td>
</tr>
<tr>
<td><a href="lxzm.asp"><img src="img/7.1" width="192" height="40" border="0" /></a></td>
</tr>
<tr>
<td><a href="lxzm.asp"><img src="img/8.1" width="192" height="41" border="0" /></a></td>
</tr>
<tr>
<td><a href="lxzm.asp"><img src="img/9.1" width="192" height="39" border="0" /></a></td>
</tr>
<tr>
<td><a href="lxzm.asp"><img src="img/10.2" width="192" height="38" border="0" /></a></td>
</tr>
<tr>
<td><a href="lxzm.asp"><img src="img/11.2" width="192" height="37" border="0" /></a></td>
</tr>
<tr>
<td><a href="lxzm.asp"><img src="img/12.2" width="192" height="53" border="0" /></a></td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</form>
</td>
<td width="76%" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="24" background="img/13.2" class="STYLE18"> <%=dl%></td>
</tr>
<tr>
<td height="163">
<table width="100%" height="167" border="1" cellpadding="0" cellspacing="0" bordercolor="#F0F0EF" frame="rhs" rules="none">
<%
dim x
x=0
do while not rs.eof
%> <tr>
<td height="161" background="img/14.3"><table width="100%" height="167" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="2%" rowspan="2"> </td>
<td width="28%" rowspan="2"> </td>
<td height="18" valign="top"><table width="100%" border="0">
<tr>
<td><span class="aaa"><%=rs("productname")%>
</span></td></tr>
</table></td>
</tr>
<tr>
<td height="135" class="aaa"><%=rs("productinfo")%> </td>
</tr>
</table></td>
</tr>
<%
x=x+1
if x>2 then exit do
rs.movenext
loop%>
</table></td>
</tr>
<tr>
<td height="13" valign="top" class="aaa">
<div align="right">
共[<font color="#FF0000"><%=maxpage%></font>]页
第[<font color="#FF0000"><%=page%></font>]页
<a href='lxzm1?page=1'><u>首 页</u></a>
<%if page<>0 then%><a href='lxzm1?page=<%=page-1%>'><u>上一页</u></a> <%end if%>
<%if page<>maxpage then%><a href='lxzm1?page=<%=page+1%>'><u>下一页</u></a> <%end if%>
<a href='lxzm1?page=<%=maxpage%>'><u>尾 页</u></a>
</div></td>
</tr>
</table></td>
<td width="3%" valign="top"><img src="img/右.gif" width="26" height="300" /></td>
</tr>
</table>
<!-- InstanceEndEditable --></td>
</tr>
<tr>
<td><img src="img/下1.gif" width="1002" height="28" /><br><img src="img/下2.gif" /><br><img src="img/下3.gif" /></td>
</tr>
</table>
</body>
<!-- InstanceEnd --></html>
<%
rs.close
set rs=nothing
conn.close
set conn=nothing
%>