设为首页 加入收藏

TOP

asp模块化分页制作详解
2011-05-31 18:04:33 来源: 作者: 【 】 浏览:744次 评论:0
模块化分页
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.knowsky.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
您看到此篇文章时的感受是:
Tags: 责任编辑:administrator
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到QQ空间
分享到: 
上一篇·关于层无法遮挡列表问题的解决.. 下一篇ASP实用大全-实战ASP(1)

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

相关栏目

最新文章

图片主题

热门文章

推荐文章

相关文章

广告位