再强推一分页方法(应用的时候,曾出现一个小问题,不过调试好后,大笑三声)

王朝asp·作者佚名  2006-01-09
宽屏版  字体: |||超大  

<table border="0" height="51" width="100%">

<%

id=request("t_id")

set rs=server.createobject("adodb.recordset")

sql="select * from news where news_type="&id&" order by news_id desc"

rs.open sql,conn,1,1

rs.pagesize=20

currentpage=Clng(request("page"))

if currentpage<1 then currentpage=1

if currentpage>rs.pagecount then currentpage=rs.pagecount

rs.absolutepage=currentpage

%>

<% do while not rs.eof %>

<tr>

<td width="94" height="25"><font color="#b8b8b8"><% =rs("news_date")%></font></td>

</tr>

<%

i=i+1

rs.movenext

if i>=rs.pagesize then exit do

loop

%>

</table><br>

<div align="center">

<table width="100%" border="0" cellpadding="0" cellspacing="0" height="34">

<tr>

<td width="100%" height="23">

<p align="center">&nbsp;总 <font color=red><% =rs.recordcount%></font>

条记录 每页显示 <%=rs.pagesize%> 条 第 <%=currentpage%>

页/共 <%=rs.pagecount%> 页&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<%if currentpage>1 then%>

<font color=666666><a href="zhixun_more.asp?t_id=<% =id%>&page=1" class="a2">

首 页 </a>

<a href="zhixun_more.asp?t_id=<%=id%>&page=<%=currentpage-1%>" class="a2">

上一页</a></font>

<%else%>首 页 上一页 <%end if%>

<%if currentpage <rs.pagecount then%>

<font color=666666><a href="zhixun_more.asp?t_id=<%=id%>&page=<%=currentpage+1%>" class="a2">

下一页</a>

<a href="zhixun_more.asp?t_id=<%=id%>&page=<%=rs.pagecount%>" class="a2">

末 页</a>

<%else%>下一页 末 页<%end if%>&nbsp; </font></p></td>

</tr></table>

</div>

<% rs.close %>

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
© 2005- 王朝网络 版权所有