zoukankan      html  css  js  c++  java
  • asp 分页代码

    使用asp作东西已经比较多了,但是一直没有注意这个东西,今天就花了一点时间写了一些,方便以后使用。

    <%SUB ListPageMenu(objRs,intrsPageSize)
     Dim rsTotal,rsPageSize,rsPageCount
     If NOT ISObject(objRs) Then Exit Sub:End If
     If NOT IsNumeric(rsPageSize) Then Exit Sub:End IF
     If objRs.Eof And objRs.Bof Then EXIT SUB:END IF
     
     objRs.PageSize=intrsPageSize
     rsTotal=objRs.RecordCount
     rsPageCount=rs.PageCount
     
     If rsTotal<0 AND (NOT (objRs.eof AND objrs.Bof))Then
      rsTotal=0
      DO WHILE NOT objRs.Eof
       rsTotal=rsTotal+1
       objRs.MoveNext
      LOOP
     End If
     
     intCurrentPage=Trim(Request.QueryString("page")) 'Get the value of intCurrentPage
     If intCurrentPage="" OR (NOT IsNumeric(intCurrentPage)) Then
      intCurrentPage=1
     End if
     
     Dim iStart,iStop
     iStart=1:iStop=1
     If Cint(intCurrentPage-3)>0 Then
      iStart=intCurrentPage-3
     Else
      iStart=1  
     End if
     iStop=iStart+7
     If iStop>rsPageCount Then
      iStop=rsPageCount
     End If
     If iStop-7<iStart AND iStart>0 Then
      iStart=iStop-7
     End If
     
     Dim strURL
     strURL=Request.ServerVariables("script_name")
     If Instr(strURL,"?")>0 Then
      strURL=strURL & "&page="
     Else
      strURL=strURL & "?page="
     End If
     
     Dim PreviousPage,NextPage
     If intCurrentPage-1>0 then
      PreviousPage=intCurrentPage-1
     Else
      PreviousPage=1
     End If
     If intCurrentPage+1<rsPageCount Then
      NextPage=intCurrentPage+1
     Else
      NextPage=rsPageCount
     End If%>
     <table width="98%" border="0" cellspacing="0" cellpadding="0">
       <tr>
      <td><a href="<%=strURL%>1" style="text-decoration:none"><font face="Webdings">9</font></a></td>
      <td><a href="<%=strURL & PreviousPage%>" style="text-decoration:none"><font face="Webdings">7</font></a></td>
      <td>
      <%Dim i
      For i=iStart to iStop Step 1%>
      <td><%response.write("<a href='" & strURL & i & "' style='text-decoration:none'>"& i &"</a>")%></td>
      <%Next%>
      </td>
      <td><a href="<%=strURL & NextPage %>" style="text-decoration:none"><font face="Webdings">8</font></a></td>
      <td><a href="<%=strURL & rsPageCount%>" style="text-decoration:none"><font face="Webdings">:</font></a></td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
       </tr>
     </table>
    <%END SUB%>

  • 相关阅读:
    算法的时间复杂度
    二叉树递归建立和遍历
    数据挖掘之分类算法---knn算法(有matlab例子)
    C链表之创建简单静态链表
    ID3决策树算法原理及C++实现(其中代码转自别人的博客)
    adobe reader安装完成之前被中断,错误代码150210解决方法
    Oracle性能诊断艺术-读书笔记
    先对结果集排序然后做update、delete操作
    索引聚簇因子相关
    直方图及low_value、high_value
  • 原文地址:https://www.cnblogs.com/AloneSword/p/2237644.html
Copyright © 2011-2022 走看看