新微赢技术网
标题:
[求助]asp分页问题
[打印本页]
作者:
叛逆ぁ太上皇
时间:
2010-1-7 04:55
标题:
[求助]asp分页问题
我想在每页生成三列三行数据的页面,但是写来写去,总是有那么点问题,大家帮我看看吧,谢谢了,在线等(我只接取了相关的ASP代码)
<% dim page,rst
page=request("page")
set rst=server.CreateObject("ADODB.RECORDSET")
rst.open "select * from hw",conn,1,1
rst.pagesize=9
page=cint(request("page"))
if page<2 then page=1
else if request("page")="" then page=1
else if page*pagesize>rst.recordset then page=pagecount
else if page*pagesize<rst.recordset then
rst.move (page-1)*pagesize
end if
%>
<%if rst.bof and rs.eof then
response.write "<p align=center>No found</p>"%>
<tr><td align=center valign=top>
<%else%>
<table width=100% cellspacing=4>
<%for i=1 to rst.pagesize
if not rst.eof then
%>
<td width="30%" align="center"><fieldset align=center>
<legend align=center><%=rst("hw_name")%></legend>
<a href="showproduct.asp?id=<%=rst("hw_id")%>"><img src=<%=rst("picurl")%> width=150 height=100></a>
</fieldset>
</td>
<%end if
rst.MoveNext%>
<%next%>
<%if i mod 3=0 then response.write "</tr>"%>
<tr><td align=center>
<form name=form1 method=post action="products.asp">
<%if page=1 and not page=rst.pagecount then%>
First|Prev|<a href="products.asp?page=<%=page+1%>">Next</a>|<a href="products.asp?page=<%=rst.pagecount%>">End</a>
<%elseif page>1 and not page=rst.pagecount then%>
<a href="products.asp?page=1">First</a>|
<a href="products.asp?page=<%=page-1%>">Prev</a>|
<a href="products.asp?page=<%=page+1%>">Next</a>|
<a href="products.asp?page=<%=rst.pagecount%>">End</a>
<% else if page=rst.pagecount then%>
<a href="products.asp?page=1">First</a>|
<a href="products.asp?page=<%=page-1%>">Prev</a>|Next|End
<%else if page=1 and page=rst.pagecount then%>
First|Prev|Next|End
<%end if%>
<input type="text" value="<%=page%>" name=page size=4><input type=submit value="GO">
</form>
<%end if%>
</td></tr>
作者:
`|楛纞♂ぺ﹖
时间:
2010-1-7 04:55
http://bbs.bc-cn.net/viewthread.php?tid=37557
yms123做的,你可以研究一下,
作者:
汽车小改装
时间:
2010-1-17 17:05
偶学习的对像‖→为你伤心为你哭
欢迎光临 新微赢技术网 (http://bbs.weiying.cn/)
Powered by Discuz! X3.2