asp分页程序

    技术2022-05-11  83

    <%

    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 ifi=0Do 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)