浏览器大全:是一个提供流行浏览器教程、在线学习分享的学习平台!

asp模块化分页

 

模块化分页

1.查询语句块

<%
取得当前文件名
temp = Split(request.ServerVariables("URL"), "/")
fy = temp(UBound(temp))
set rs=server.createobject("adodb.recordset")
if not isempty(request("page")) then  
pagecount=cint(request("page"))  
else  
pagecount=1  
end if
sql="select  查询语句"
rs.open sql,conn,1,1
rs.pagesize=10  分页记录数
if pagecount>rs.pagecount or pagecount<=0 then             
pagecount=1             
end if            
if rs.eof and rs.bof then%>

<div align="center" class="001"><br>
对不起,没有符合搜索条件的记录!<br>
</div>

2.显示记录块

<%
else
rs.AbsolutePage=pagecount
do while not rs.eof %>

显示的记录

<% i=i+2                                                                                                 
rs.movenext                                                                                                 
if i>=rs.PageSize then exit do
loop                                                                   
%>

3.
分页效果
<table width="778" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr align="center">
    <% if rs.pagecount=1 then %>
    <td height="35" colspan="4" class=001><font color="#000000">共有[<font color="#ff0000"><%=rs.recordcount%></font>]条信息 当前显示第 <font color="red">1~<%=rs.recordcount%></font>条</font></td>
  </tr>
  <tr>
    <%else%>
    <td width="19%" height="35" align="center" valign="middle" class=001><font color="#000000">
      <% page_start=(pagecount-1)*rs.pagesize
            if pagecount=1 then page_start=1
      page_end=rs.pagesize*pagecount
      if pagecount*rs.pagesize=>rs.recordcount then page_end=rs.recordcount end if%>
      共有[<font color="#ff0000"><%=rs.recordcount%></font>]信息</font></td>
    <td width="58%" height="30" align="center" class="fy"><font color="#000000">
          <%
    if pagecount>5 and pagecount< rs.PageCount-5 and rs.pagecount>10 then
    qizu=pagecount-4
    min=pagecount+5
    response.write "<a href="&source&"?page=1&sortid="&sortid&"&typeid="&typeid&"&qylb="&qylb&"&title="&title&"&cityid="&cityid&"><font color='0000BE'>首页</font></a>&nbsp;"
    response.write "<a href="&source&"?page="+cstr(pagecount-1)+"&sortid="&sortid&"&typeid="&typeid&"&qylb="&qylb&"&title="&title&"&cityid="&cityid&"><font color='0000BE'>上一页</font></a>&nbsp;"                                                    
    for ipage=qizu to min
             if ipage<>pagecount then
             response.write "<a href="&source&"?page="+cstr(ipage)+"&sortid="&sortid&"&typeid="&typeid&"&qylb="&qylb&"&cityid="&cityid&"><font color='0000BE'>"+cstr(ipage)+"</font></a>&nbsp;"
             else
             response.write "<font color='#FF0000'>"&ipage&"</font> "                                               
             end if
    next
    response.write "<a href="&source&"?page="+cstr(pagecount+1)+"&sortid="&sortid&"&typeid="&typeid&"&qylb="&qylb&"&title="&title&"&cityid="&cityid&"><font color='0000BE'>下一页</font></a>&nbsp;"
    response.write "<a href="&source&"?page="+cstr(rs.PageCount)+"&sortid="&sortid&"&typeid="&typeid&"&qylb="&qylb&"&title="&title&"&cityid="&cityid&"><font color='0000BE'>尾页</font></a>"
    end if
    if rs.PageCount<11 then
    for ipage=1 to rs.PageCount
             if ipage<>pagecount then
             response.write "<a href="&source&"?page="+cstr(ipage)+"&sortid="&sortid&"&typeid="&typeid&"&qylb="&qylb&"&cityid="&cityid&"><font color='0000BE'>"+cstr(ipage)+"</font></a>&nbsp;"
             else
             response.write "<font color='#FF0000'>"&ipage&"</font> "                                               
             end if
    next
    end if
    if pagecount < 6 and rs.PageCount>10 then
    for ipage=1 to 10
             if ipage<>pagecount then
             response.write "<a href="&source&"?page="+cstr(ipage)+"&sortid="&sortid&"&typeid="&typeid&"&qylb="&qylb&"&cityid="&cityid&"><font color='0000BE'>"+cstr(ipage)+"</font></a>&nbsp;"
             else
             response.write "<font color='#FF0000'>"&ipage&"</font> "                                               
             end if
    next
    response.write "<a href="&source&"?page="+cstr(rs.PageCount)+"&sortid="&sortid&"&typeid="&typeid&"&qylb="&qylb&"&title="&title&"&cityid="&cityid&"><font color='0000BE'>尾页</font></a>"
    end if
    if pagecount>rs.PageCount-6 and rs.PageCount>10 then
    response.write "<a href="&source&"?page=1&sortid="&sortid&"&typeid="&typeid&"&qylb="&qylb&"&title="&title&"&cityid="&cityid&"><font color='0000BE'>首页</font></a>&nbsp;"  
    for ipage=rs.PageCount-9 to rs.PageCount
             if ipage<>pagecount then
             response.write "<a href="&source&"?page="+cstr(ipage)+"&sortid="&sortid&"&typeid="&typeid&"&qylb="&qylb&"&cityid="&cityid&"><font color='0000BE'>"+cstr(ipage)+"</font></a>&nbsp;"
             else
             response.write "<font color='#FF0000'>"&ipage&"</font> "                                               
             end if
    next
    end if
             %>
    </font></td><form name=go2to form method=Post action=<%=fy%>> 
    <td width="13%" align="center" valign="middle" class="fy">                                         
   <input type='hidden' name='sortid' value="<%=sortid%>"><input type='hidden' name='typeid' value="<%=typeid%>"><input type='hidden' name='qylb' value="<%=qylb%>"><input type='hidden' name='title' value="<%title%>"><input type='hidden' name='cityid' value="<%=cityid%>"><font color='000064'> 转到第<input type='text' name='page' size=2 maxLength=3>
   页</font>                              
   </td>
    <td width="10%" align="center" valign="middle" class="fy"><input name="image" type='image' onClick=check() value='确 定' src='http://edu.chinaz.com/Get/Program/images/button_h.jpg'></td>
    </form>
  <tr>
    <td height="20" colspan="6" valign="bottom"><font color="#000000">&nbsp; </font></td>
  </tr>
  <% end if %>
  <% end if %>
</table>





相关软件

2345加速浏览器官方版

2345加速浏览器官方版 | 56.2MB

2345加速浏览器官方版

新一代2345加速浏览器采用Chromium和IE双内核,主打极速与安全特性。基于Chromium深度定制,引入网页智能预加载技术,访问网页更快速..

QQ浏览器官方正式版

QQ浏览器官方正式版 | 49.67MB

QQ浏览器官方正式版

QQ浏览器秉承TT浏览器1-4系列方便易用的特点,但技术架构不同,交互和视觉表现也重新设计,采用Chromium内核+IE双内核,让浏览快速稳定...

百度浏览器最新版下载

百度浏览器最新版下载 | 13.3MB

百度浏览器最新版下载

q百度浏览器,是一款简洁轻快、智能懂你的浏览器。依靠百度强大的搜索平台,在满足用户浏览网页的基础上,它整合百度体系业务优势,带给用户更方便的浏览方式功能...

UC浏览器官方正式版

UC浏览器官方正式版 | 44.2MB

UC浏览器官方正式版

UC浏览器(UC Browser)是UC Mobile Limited在2004年8月开发的一款软件,分uc手机浏览器和uc浏览器电脑版。UC浏览器是全球使用量最大的第三方手机浏览器...

猎豹浏览器2022最新版下载

猎豹浏览器2022下载 | 45MB

猎豹浏览器2022最新版下载

猎豹安全浏览器对Chrome的Webkit内核进行了超过100项的技术优化,访问网页速度更快。其具有首创的智能切换引擎,动态选择内核匹配不同网页...

360安全浏览器官方版下载

360安全浏览器下载 | 21.4MB

360安全浏览器官方版下载

360安全浏览器拥有全国最大的恶意网址库,采用恶意网址拦截技术,可自动拦截挂马、欺诈、网银仿冒等恶意网址。独创沙箱技术,在隔离模式即使访问****也不会感染...