分页显示的代码,页面可以跳转,但是点击上一页,下一页没有数据
<!--#include file="conn.ASP"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
<link href="css/css.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.L14 {LINE-HEIGHT: 140%
}
.L15 {LINE-HEIGHT: 150%
}
.orange {FONT-SIZE: 12px; COLOR: #ff6600; TEXT-DECORATION: none
}
.STYLE3 {color: #999999}
.style7 {COLOR: #333333; LINE-HEIGHT: 18px; FONT-FAMILY: "Verdana", "Arial", "Helvetica", "sans-serif"; font-weight: normal;}
.style9 {font-size: 12px}
body {
background-color: #FF9966;
}
-->
</style>
</head>
<body>
<table width="770" border="0" align="left" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td width="570" align="left" valign="top"><table width="98%" border="0" align="center" cellpadding="3" cellspacing="0">
<tr>
<td><a class=""
href="first.asp"></a><font class=""> > </font><a href="qyxw.asp">厂家类别</a> <font class="">> </font>所有厂家</td>
</tr>
<tr>
<td><hr size="1"></td>
</tr>
</table>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><table cellspacing=0 cellpadding=0 width="100%" border=0>
<tbody>
<tr>
<td valign="top" class=nr-st-9pt-16line-shsj><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="3">
<%
work=request("work")
sql="select * from HN_news where changjia='"&work&"'order by id desc"
set rsnews=server.createobject("adodb.recordset")
rsnews.open sql,conn,1,1
IF Not rsnews.eof Then
proCount=rsnews.recordcount
rsnews.PageSize=20 '定义显示数目
if not IsEmpty(Request("ToPage")) then
ToPage=CInt(Request("ToPage"))
if ToPage>rsnews.PageCount then
rsnews.AbsolutePage=rsnews.PageCount
intCurPage=rsnews.PageCount
elseif ToPage<=0 then
rsnews.AbsolutePage=1
intCurPage=1
else
rsnews.AbsolutePage=ToPage
intCurPage=ToPage
end if
else
rsnews.AbsolutePage=1
intCurPage=1
end if
intCurPage=CInt(intCurPage)
For i = 1 to rsnews.PageSize
if rsnews.EOF then
Exit For
end if
%>
<tr>
<td width="3%"><span class="td_XX2">·</span></td>
<td width="79%"><span class="style9"><a href="newsdisp.asp?id=<%=rsnews("id")%>" target="_blank">
<% = Left(rsnews("changjia"),30) %>
<% if Len(rsnews("title"))>30 then %>
…
<% end if %>
</a></span></td>
<td width="18%" class="high20 style9"><span class="STYLE3">[<%=rsnews("ADD")%>]</span></td>
</tr>
<%
rsnews.MoveNext
next
%>
</table>
<table width="100%" align="center" cellpadding="0" cellspacing="0" border="0">
<form name="form1" method="post" action="">
<tr>
<td align="right" height="20"><span style="font-size: 9pt;"> 总共:<font color="#ff0000"><%=rsnews.PageCount%></font>页, <font color="#ff0000"><%=proCount%></font>条新闻, 当前页:<font color="#ff0000"> <%=intCurPage%> </font>
<% if intCurPage<>1 then%>
<a href="?ToPage=1">首页</a>|<a href="?ToPage=<%=intCurPage-1%>">上一页</a>|
<% end if %>
<% if intCurPage<>rsnews.PageCount then %>
<a href="?ToPage=<%=intCurPage+1%>">下一页</a>|<a href="?ToPage=<%=rsnews.PageCount%>"> 最后页</a>|
<% end if%>
跳转:
<input name="topage" type="text" size="2" value="<%=intCurPage%>">
<input type="submit" name="go" value="转到">
</span> </td>
</tr>
</form>
</table></td>
</tr>
</table></td>
</tr>
</table>
<%else%>
<table width="60%" border="0" align="center">
<tr>
<td align="center">暂时没有厂家</td>
</tr>
</table>
<%end if%>
</td>
</tr>
</table>
<%
rsnews.close
set rsnews=nothing
%></td>
</tr>
</table></td>
<td width="189" align="center" valign="top" bgcolor="#E7E7E7" class="td_n_l"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="5"></td>
</tr>
</table>
</tr>
</table>
<table width="770" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="5" bgcolor="#FFFFFF"></td>
</tr>
</table>
</body>
</html>
[解决办法]
页面参数 传递问题
href="?work="& work &"&ToPage
[解决办法]
<% if intCurPage <>1 then%>
<a href="?ToPage=1&work=<%=work%>">首页 </a> ¦ <a href="?ToPage= <%=intCurPage-1%>&work=<%=work%>">上一页 </a> ¦
<% end if %>
<% if intCurPage <>rsnews.PageCount then %>
<a href="?ToPage= <%=intCurPage+1%>&work=<%=work%>">下一页 </a> ¦ <a href="?ToPage= <%=rsnews.PageCount%>&work=<%=work%>"> 最后页 </a> ¦
<% end if%>
