- 热门文章:
- · ASP分页显示详论
- · Iframe高度自适应
- · 正则表达式大全
- · WMI学习
- · Session 详解
- · 关于交叉报表的动态实现
- · 页面执行需要长时间时向用户的提示信息
- · 使用Repeater模板 二
- · Sucess On a Horse
- · 校友通讯资料管理系统(1)
- · ASP实现图片上存
- · 提高网站在搜索引擎中的排名
上一篇:域名查询系统--适合新手 >>
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=‘’../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>
下一篇:ASP分页显示详论 >>
相关文章:
- · 关于无组上传的老话题
- · 如何实现图片的随机生成与显示
- · 怎么把webapplication打包成安装文件
- · 为treeview添加客户端事件
- · 如何让不同的语言版本显示正确的中文?
- · 线程的处理(2)
- · 线程的处理(1)
- · 再谈ASP防止SQL Injection漏洞的问题
- · 用asp编写文档搜索页面
- · ASP中使用SQL语句
- · 利用反射动态调用类成员
- · Asp.net组件设计浅论
- · 越过调试这道槛——ASP.NET无法调试问题剖析
- · 一段用ASP查看ASP文件源码的程序.
- · ASP显示在线人数
- · Asp.net多页面间保留状态
- · 简单ASP计数器
- · 使用 HttpContext.RewritePath 来配合 Server.Transfer/Execute
- · SQLSERVER扩展存储过程XP_CMDSHELL的简单应用
- · SQL Server 存储过程的分页
- · 经典的asp整理
- · Access中分组统计的实例
- · 一段分页程序实例代码!
- · 从asp到asp.net之快速转型
- · ASP升级程序
- · 利用WebClient类向服务器上载文件
- · .net中Web自定义控件编写的几个注意事项
- · 奇妙的.NET之Web程序中使用windows弹出框
- · webservice.htc无法传递中文数据的解决
- · 用反射调用别人的.NET程序里的类和方法
- · DataView如何绑定Web Service返回的主从表数据集
- · 在类中添加断言
- · UBB代码的实现(ASP)
- · 精确的判断网络是否可用
- · 调试SharePoint web part时, 如何可以多个人同时启动调试?
- · 关于编译器失败,错误代码为 128。的解决方案
- · 如何实现将用户上传的文件生成缩略图!
- · 链接提示文字的实现
