|
我想在每页生成三列三行数据的页面,但是写来写去,总是有那么点问题,大家帮我看看吧,谢谢了,在线等(我只接取了相关的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> |
|