asp模块化分页源码
来源:CSDN 发布时间:2008-04-13 07:02:00
标签:分页,模块,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> "
response.write "<a href="&source&"?page="+cstr(pagecount-1)+"&sortid="&sortid&"&typeid="&typeid&"&qylb="&qylb&"&title="&title&"&cityid="&cityid&"><font color='0000BE'>上一页</font></a> "
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> "
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> "
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> "
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> "
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> "
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> "
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"> </font></td>
</tr>
<% end if %>
<% end if %>
</table>
0
投稿
猜你喜欢
- mysql安装好经常发现无法正常启动碰到最多的是error 2003的错误,以下为解决方法: mysqld -nt -remove mysq
- 本教程操作环境:windows7系统、vue2.9.6版,DELL G3电脑。一、组件是什么回顾以前对组件的定义:组件就是把图形、非图形的各
- 函数原型与参数详解OpenCV提供了cv.Canny()方法,该方法将输入的原始图像转换为边缘图像。该方法的原型为:cv.Canny(ima
- 函数的迭代器函数的强大功能叫做迭代器,Python里面最具威力的功能之一。迭代器我们听起来会感觉非常陌生,在list、tuple都有用到它,
- 使用JdbcTemplate的步骤1、设置spring-jdbc和spring-tx的坐标(也就是导入依赖) <depen
- 1.读取CSV文件到Listdef readCSV2List(filePath): try: file=open(filePat
- 一、装饰器由于一个函数能实现一种功能,现在想要在不改变其代码的情况下,让这个函数进化一下,即能保持原来的功能,还能有新的"技能&q
- 一.链接打开方式1、新窗口打开优点:用户点链接的时候,当前浏览的内容不会被替换,不需要通过前进、后退去看自己看过的内容;缺点:访问一会,就会
- <%If(Request.QueryString("Page")="") ThenPage=1
- 测试环境:1:xp系统2:双显,1680×1050 + 1050×16803:chrome 版本4.14:ff版本3.6chrome是我的默
- 此功能已进入试用一周了,都没有问题,奇怪的是今天出现了问题?? AjaxRequestObj.createEqStatusParameter
- 目前,我们要在网页中使用圆角效果,总是通过切图然后嵌套很多div,用背景来实现圆角效果。对于前端开发工程师来说,圆角的确是一个让人又爱又恨的
- Cloudflare 有一项功能挺不错的,就是将页面上所有的邮箱地址都加密起来,防止机器人抓到然后干坏事。这项功能要在后台开启 email
- __author__ = 'clownfish'#coding:utf-8import urllib2,urllib,coo
- Golang中的time.After的使用理解关于在goroutine中使用time.After的理解, 新手在学习过程中的“此时此刻”的理
- 在 Python 中,我们会经常听到上下文管理器(Context Manager),那我们探讨下这是什么,又有什么功能。在 Python 中
- 一、前言Hadoop原理架构本人就不在此赘述了,可以自行百度,本文仅介绍Hadoop-3.1.2完全分布式环境搭建(本人使用三个虚拟机搭建)
- 什么是拼音转换在我们学习语言之前,我们一般会学习拼音来认识汉字,并学会如何读汉字。所以,拼音在对于我们语言的重要性不言而喻。而拼音转换指的是
- 本文实例讲述了Sanic框架异常处理与中间件操作。分享给大家供大家参考,具体如下:简介Sanic是一个类似Flask的Python 3.5+
- 0、前言在python2.7及以上的版本,str.format()的方式为格式化提供了非常大的便利。与之前的%型格式化字符串相比,他显得更为