农产品淘宝店:请各位大侠,帮忙看看这个翻页代码怎么改?

来源:百度文库 编辑:查人人中国名人网 时间:2024/04/29 06:58:32
<%
infokeyword=request("infokeyword")
Set userq = Server.CreateObject("ADODB.Connection")
userq.open mallDSN
set rs=server.createobject("ADODB.Recordset")
sql= "select info_class.*,info_item.*,info_class.class as class1,info_item.class as class2 from info_class,info_item where info_class.class=info_item.class and (info_item.itemname like '%"&infokeyword&"%' or info_class.name like '%"&infokeyword&"%')"
rs.open sql,userq,adOpenStatic
while not rs.eof
if j<1 then
%>
<div align="center">
<center>
<table width="100%" cellpadding="0" cellspacing="1">
<td width="100%" height="1">
<div align="center">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="25" height="1" align="right" valign="middle" bgcolor="#EAF4FB">
<p align="center"><img src="images/icon1.gif" width="11" height="7"></p>
</td>
<td width="393" height="1" bgcolor="#EAF4FB" class="style6"> <p align="left" class="style6"><a href="info_details.asp?id=<%=rs("id")%>" target="_blank"><%=rs("itemname")%>
</a></td>
<td width="97" bgcolor="#EAF4FB"><div align="right" class="style7">
<div align="left"><a href="infobs.asp?class=<%=rs("class")%>" target="_blank"><%=rs("name")%></div>
</div></td>
<%
j=j+1
else
%>
<td width="62" height="1" bgcolor="#EAF4FB"><div align="right" class="style7"><%=realdate(rs("declaredate"))%></div></td>
</tr></table>
</div></td>
<%
j=0
end if
rs.movenext
wend
rs.close
userq.close
%>

搞了一天,快郁闷S了~!一定要帮我啊!

你要怎么改啊??

你的j是什么东东呀?还有,是分页还是翻页?

Rs.PageSize =10 '每页显示数
Page=request.querystring("Page")
if Not IsEmpty(Page) then
if Not IsNumeric(Page) then
Page=1
else
Page = cint(Page)
end if
if Page > rs.PageCount then '如果接收的页数大于总页数
rs.AbsolutePage = rs.PageCount '设置当前显示页等于最后页
elseif Page <= 0 then '如果Page小于等于0
rs.AbsolutePage = 1 '设置当前显示页等于第一页
else
rs.AbsolutePage = Page '如果大于零,显示当前页等于接收的页数
end if
else
rs.absolutePage=1
end if
myPagesize = rs.Pagesize
Page = rs.AbsolutePage
.
.
.
.
do while not Rs.eof and myPagesize>0
%>
...
<%
myPagesize=myPagesize-1
rs.MoveNext
Loop
%>
<form action="<%=filepath%>" method="get" >
<!--首先保证总页数不为1、不为0-->
<%if rs.Pagecount<>1 and rs.Pagecount<>0 then%>
<!--如果当前页数大于1,无论何时都应显示首页和上一页的连接-->
<%if Page>1 then%>
[<a Href="<%=filepath%>?Page=<% = 1%><% if FL<>"" then response.Write "&FenLei=" & FL %>"><font color="#FFFFFF">首页</font></a>]
[<a Href="<%=filepath%>?Page=<% = Page -1 %><% if FL<>"" then response.Write "&FenLei=" & FL %>" ><font color="#FFFFFF">上一页</font></a>]
<!--如果当前页数大于1并且小于总页面数时,显示出尾页和下一页的连接-->
<%if Page<rs.Pagecount then %>
[<a Href="<%=filepath%>?Page=<% = Page + 1%><% if FL<>"" then response.Write "&FenLei=" & FL %>"><font color="#FFFFFF">下一页</font></a>]
[<a Href="<%=filepath%>?Page=<% = rs.PageCount%><% if FL<>"" then response.Write "&FenLei=" & FL %>"><font color="#FFFFFF">尾页</font></a>]
<!--如果当前页数大于1并且仍大于或等于总页面数时,不显示出尾页和下一页的连接-->
<%else%>
[下一页] [尾页]
<%end if%>
<!--否则,当前页数不大于1,则只显示尾页和下一页的连接-->
<%else%>
[首页] [上一页]
[<a Href="<%=filepath%>?Page=<% = Page + 1%><% if FL<>"" then response.Write "&FenLei=" & FL %>"><font color="#FFFFFF">下一页</font></a>]
[<a Href="<%=filepath%>?Page=<% = rs.PageCount%><% if FL<>"" then response.Write "&FenLei=" & FL %>"><font color="#FFFFFF">尾页</font></a>]
<%end if %>
<!--最终,总页数若为1、为0则没有任何连接-->
<%else%>
[首页] [上一页] [下一页] [尾页]
<%end if%>

[页次:<font color=red><b><%=Page%></b></font>/<%=rs.PageCount%>]
[共<%=rs.RecordCount%>篇 <font color=red><b><%=rs.PageSize%></b></font>篇/页]
转到<input name="Page" size=5 value="
<%
if Page = -1 then
Page = 0
end if
response.Write Page
%>">页
<%
IF FL <> "" then
%>
<input name="fenlei" type="hidden" value="<%=FL%>" />
<%
end if
%>
<input type="submit" value="Enter">
<%
Rs.Close
%>
</form>