当前位置: 首页 > 图文教程 > 网络编程 > ASP > ASP分页函数

ASP
制作我们自己的Ebay(拍卖系统)(3)
制作我们自己的Ebay(拍卖系统)(4)
制作我们自己的Ebay(拍卖系统)(5)
制作我们自己的Ebay(拍卖系统)(6)
制作我们自己的Ebay(拍卖系统)(8)
制作我们自己的Ebay(拍卖系统)(9)
制作我们自己的Ebay(拍卖系统)(7)
作一个可以直接和浏览器进行交互的组件
用ASP+实现一个简单的计算器(适合入门者)
用多种方法制作WEB页面的计数器
asp+的论坛列表程序---代码部分
asp+的论坛列表程序---页面部分
asp+版本简单的留言板的制作(一)
asp+版本简单的留言板的制作(二)
asp+版本简单的留言板的制作(三)
一个功能完善的专栏管理的程序->这是asp.net的第二个应用(一)
一个功能完善的专栏管理的程序->这是asp.net的第二个应用(二)
一个功能完善的专栏管理的程序->这是asp.net的第二个应用(三)
一个功能完善的专栏管理的程序->这是asp.net的第二个应用(四)
一个功能完善的专栏管理的程序->这是asp.net的第二个应用(五)

ASP分页函数


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 113 ::
收藏到网摘: n/a

Function ExportPageInfo(ByRef rs,curpage,i,LinkFile)
Dim retval, j, pageNumber, BasePage
retval = "第" & curpage & "页/总" & rs.pagecount & "页 " 
retval = retval & "本页" & i & "条/总" & rs.recordcount & "条 "
If curpage = 1 Then 
retval = retval & "首页 前页 " 
Else 
retval = retval & "<a href=’’" & LinkFile & "page=1’’>首页</a> <a href=’’" & LinkFile & "page=" & cstr(curpage - 1) & "’’>前页</a> " 
End If
If curpage = rs.pagecount Then 
retval = retval & "后页 末页"
Else
retval = retval & "<a href=’’" & LinkFile & "page=" & cstr(curpage + 1) & "’’>后页</a> <a href=’’" & LinkFile & "page=" & cstr(rs.pagecount) & "’’>末页</a>"
End if
retval = retval & "<br/>"
BasePage = (curpage \ 10) * 10
If BasePage > 0 Then retval = retval & " <a href=’’" & LinkFile & "page=" & (BasePage - 9) & "’’><<</a>"
For j = 1 to 10
pageNumber = BasePage + j
If PageNumber > rs.pagecount Then Exit For
If pageNumber = Cint(curpage) Then
retval = retval & " <font color=’’#FF0000’’>" & pageNumber & "</font>"
Else
retval = retval & " <a href=’’" & LinkFile & "page=" & pageNumber & "’’>" & pageNumber & "</a>"
End If
Next
If rs.pagecount > BasePage Then retval = retval & " <a href=’’" & LinkFile & "page=" & (BasePage + 11) & "’’>>></a>"
ExportPageInfo = retval
End Function



应用
<%
adoPageRS.open "SELECT * FROM news ORDER BY addtime DESC", conn, 1, 1
if err.number <> 0 then
response.write "数据库操作失败:"&err.description
else
if adoPageRS.eof and adoPageRS.bof then
response.write "没有记录"
else
%>
<div align="center"> 
<center>
<table width="100%" border="0" cellspacing="1" cellpadding="2">
<tr class="big"> 
<td width="60%">新 闻 标 题</td>
<td width="25%" align="center">日期</td>
<td width="15%" align="center">操  作</td>
</tr>
<% 
adoPageRS.pagesize = 10 
adoPageRS.absolutepage = curpage 
for i = 0 to 9 
%>
<tr> 
<td><%= adoPageRS("title") %></td>
<td align="center"> 
<% = adoPageRS("addtime") %>
</td>
<td align="center"><a href=’’newsman.asp?action=edit&id=<%= adoPageRS("id")%>’’>编辑</a>