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

类别:Asp 点击:0 评论:0 推荐:
       <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 %>

本文地址:http://com.8s8s.com/it/it7735.htm