选择显示字体大小

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



 


关键字 本文所属关键字

相关 与本文相关文章

分类 所有文章关键字导航

源码编程相关

Java   Asp   PHP   .Net   XML   C/C++   CGI   VB   Jsp   J2ee   J2se   J2me   EJB   Servlet   Tomcat   Resin   Struts   Weblogic   Eclipse   ANT   GUI   JMS   Web servise   IDEA   Webphere   Hibernate   Spring   Jboss   Applet   Swing   Socket   Javamail   Perl   Ajax   P2P   安全   模式   框架   测试   开源   游戏

SQL数据库相关

My-SQL   Ms-SQL   Access   DB2   Oracle   Sybase   SQLserver   索引   存储过程   加密   数据库   分页   视图  

手机无线相关

3G   Wap   CDMA   GRPS   GSM   IVR   彩信   短信   无线   增值业务

网页设计制作相关

HTML   CSS   网页配色   网页特效   Javascript   VBscript   Dreamweaver   Frontpage   JS   Web   网站设计

网站建设推广相关

建站经验   网站优化   网站排名   推广   Alexa

操作系统/服务器相关

Windows XP   Windows 2000   Windows 2003   Windows Me   Windows 9.x   Linux   UNIX   注册表   操作系统   服务器   应用服务器

图形图像多媒体相关

Photoshop   Fireworks   Flash   Coreldraw   Illustrator   Freehand   Photoimpact   多媒体   图形图像

标准 网站致力的规范

Valid CSS!

无不良内容,无不良广告,无恶意代码

Valid XHTML 1.0 Transitional

creativecommons