zoukankan      html  css  js  c++  java
  • asp通用分页函数

     1<%dim rs3,pm3,bg
     2page=clng(request("page"))
     3set rs3 = server.createobject("adodb.recordset")
     4sql3 = "select distinct brlword from userinfo where bfenshuduan='"&key&"' order by brlword"
     5rs3.open sql3,conn,1,1
     6if rs3.eof then
     7%>
     8    <tr>
     9      <td width="580" colspan="5">
    10    <p align="center"><font color="#FF0000">对不起,没有符合条件的高校!</font>
    11
    12      </td>
    13    </tr>
    14    <tr>
    15     <td width="580" colspan="5">
    16<else %>
    17<%
    18const maxperpage=1
    19dim currentpage
    20rs3.pagesize=maxperpage
    21currentpage=request.querystring("pageid")
    22if currentpage="" then
    23currentpage=1
    24elseif currentpage<1 then
    25currentpage=1
    26else
    27currentpage=clng(currentpage)
    28    if currentpage > rs3.pagecount then
    29    currentpage=rs3.pagecount
    30    end if
    31end if
    32
    33if not isnumeric(currentpage) or currentpage="" then
    34currentpage=1
    35end if
    36dim totalput,n
    37totalput=rs3.recordcount
    38if totalput mod maxperpage=0 then
    39n=totalput\maxperpage
    40else
    41n=totalput\maxperpage+1
    42end if
    43if n=0 then
    44n=1
    45end if
    46rs3.move(currentpage-1)*maxperpage
    47i=0
    48do while i< maxperpage and not rs3.eof
    49        %>
    50        <tr>
    51        <td><%=getschoolinfo(rs3("brlword"),1)%></td>
    52        <td><%=getschoolinfo(rs3("brlword"),2)%></td>
    53        <td><%=getschoolinfo(rs3("brlword"),5)%></td>
    54        <td><%=getschoolinfo(rs3("brlword"),3)%></td>
    55        <td><%=getschoolinfo(rs3("brlword"),4)%></td>
    56      </tr>
    57<%                                                                         
    58i=i+1                                                      
    59rs3.movenext                                                        
    60loop                                                                                 
    61                                    
    62%>   
    63    </table>
    64<p align="center">页数:<%=currentpage%>/<=n%>                                                       
    65       <%k=currentpage                                                                                
    66       if k<>1 then%>                                                            
    67       <a href="picitop2.asp?pageid=1">首页</a>                                                                                
    68       <a href="picitop2.asp?pageid=<%=k-1%>&key=<%=key%>">上一</a>                                                                                
    69       <%else%>                                                            
    70       首页 上一页                                                                                
    71       <%end if%>                                                            
    72       <%if k<>then%>                                                                                
    73       <a href="picitop2.asp?pageid=<%=k+1%>&key=<%=key%>">下一</a>                                                                                
    74       <a href="picitop2.asp?pageid=<%=n%>&key=<%=key%>">尾页</a>                                                                                
    75       <%else%>                                                            
    76       下一页 尾页                                                                                
    77       <%end if%>                                                            
    78     共为您找到<font color="red"><%=totalput%></font>所高校
    79 
  • 相关阅读:
    几种常用的正则
    手机中间4位为*的方法
    关于在Vue中,只要单个列表显示模态框的做法。
    KMP算法
    排序算法的实现
    设计模式之单例模式
    慕课网--》从零做一个前端开源项目笔记
    Ubuntu安装sublime Text 3并配置可以输入中文
    ubuntu使用git时,终端不显示git分支。
    ubuntu使用git的时:Warning: Permanently added the RSA host key for IP address '13.250.177.223' to the list of known hosts.
  • 原文地址:https://www.cnblogs.com/icejd/p/190053.html
Copyright © 2011-2022 走看看