asp分页程序

<%

sql="select * from table where ... order by zcrq desc"
  rs.open sql,conn,1
  if not rs.eof Then
   rs.PageSize = 30      '每页显示的记录数
   pre = true         '往前翻页
      last = true        '往后翻页
      page = trim(Request.QueryString("page")) '获取页面返回的页码
     
      if  len(page) = 0 then   '当前页
                  intpage = 1
                  pre = false                   '前翻禁止
      else
          if cint(page) =< 1 then
               intpage = 1
               pre = false                      '前翻禁止
          else
              if cint(page) >= rs.PageCount then'尾页
                  intpage = rs.PageCount
                  last = false                  '后翻禁止
              else
                   intpage = cint(page)
             end if
         end if
      end if
    if not rs.eof then
         rs.AbsolutePage = intpage              '当前页赋值
    end if
i=0
Do While Not Rs.EOF and i<rs.PageSize            '循环显示记录
i=i+1 

%>

<table>..........循环显示的记录内容

</table>

  <%
   rs.movenext
   loop
 %>

---------------------------------分页表格----------------------------------------------------------   

  <%if rs.pagecount > 0 then '分页的表现形式(总页数)%> 
     <td width="13%" align="left">当前页<%=intpage%>/<%=rs.PageCount%></td>
     <%else%>
    <td width="41%" align="left">当前页0/0</td><%end if%>
    <td width="46%" align="right"> <a href="yizhuce.asp?page=1">首页</a>|
     <%if pre then%>
     <a href="yizhuce.asp?page=<%=intpage -1%>">上页</a>| <%end if%>
     <%if last then%>
      <a href="yizhuce.asp?page=<%=intpage +1%>">下页</a> |<%end if%>
      <a href="yizhuce.asp?page=<%=rs.PageCount%>">尾页</a>|转到第
      <select name="sel_page" οnchange="javascript:location=this.options[this.selectedIndex].value;">
      <%
       for i = 1 to rs.PageCount
       if i = intpage then%>
       <option value="yizhuce.asp?page=<%=i%>" selected><%=i%></option>
     <%else%>
       <option value="yizhuce.asp?page=<%=i%>"><%=i%></option>
        <%
          end if
        next
        %>
     </select>页</font>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值