网络编程 | 站长之家 | 网页制作 | 图形图象 | 操作系统 | 冲浪宝典 | 软件教学 | 网络办公 | 邮件系统 | 网络安全 | 认证考试 | 系统进程
Firefox | IE | Maxthon | 迅雷 | 电驴 | BitComet | FlashGet | QQ | QQ空间 | Vista | 输入法 | Ghost | Word | Excel | wps | Powerpoint
asp | .net | php | jsp | Sql | c# | Ajax | xml | Dreamweaver | FrontPages | Javascript | css | photoshop | fireworks | Flash | Cad | Discuz!
当前位置 > 网站建设学院 > 网络编程 > ASP技巧
Tag:注入,存储过程,分页,安全,优化,xmlhttp,fso,jmail,application,session,防盗链,stream,无组件,组件,md5,乱码,缓存,加密,验证码,算法,cookies,ubb,正则表达式,水印,索引,日志,压缩,base64,url重写,上传,控件,Web.config,JDBC,函数,内存,PDF,迁移,结构,破解,编译,配置,进程,分词,IIS,Apache,Tomcat,phpmyadmin,Gzip,触发器,socket
网络编程:ASP教程,ASP.NET教程,PHP教程,JSP教程,C#教程,数据库,XML教程,Ajax,Java,Perl,Shell,VB教程,Delphi,C/C++教程,软件工程,J2EE/J2ME,移动开发
本月文章推荐
.在access中增加农历支持模块.
.存储过程使用大全.
.怎样在网站上连接ORACLE数据库.
.一个BBS的源代码(三).
.将ASP纪录集输出成n列的的表格形.
.NT 下虚拟域名的实现.
.用一套论坛程序架设多个论坛.
.利用XML不离开页面刷新数据.
.IIS使用10则.
.ORACLE920与ASP的连接问题的解决.
.在不支持FSO的服务器上使用XMLDO.
.asp中自定义文件下载.
.用模板建立动态ASP页.
.利用SQLSERVER存储过程实现ASP用.
.Filter与updatebatch混合使用实现.
.动态网站首页的静态生成方法.
.IIS 5.0新功能.
.如何增强ASP程序性能(4).
.对ASP脚本源代码进行加密.
.纯猝使用VBScript来实现加密.

asp模块化分页制作详解

发表日期:2004-10-20


模块化分页

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
'www.gaoqian.com
%>

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='../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>

上一篇:升级MD5.ASP,打造完全动态不重复的安全加密代码 人气:15592
下一篇:ASP安全检测与过滤函数SafeCheck 人气:13668
浏览全部分页制作的内容 Dreamweaver插件下载 网页广告代码 祝你圣诞节快乐 2009年新年快乐