分页函数[1]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 musicfree_uibe 的 blog

函数如下:

<%
private function fenye(rs, pagesize,args)
dim intcur
dim intpagesize
dim total
dim inttotal

args = split(args,",")
if  request.querystring("page")="" then 
 intcur=1
 page = "first"
else
 select  case  request("page")
         case  "first"
                 intcur=1
                case  "previous"
                 intcur=cint(request("curpage"))
                 intcur=intcur-1
                case  "next"
                 intcur=cint(request("curpage"))
                 intcur=intcur+1
                case  "last"
                 intcur=cint(request("lastpage"))
                case  else 
                    intcur=request("page")
 end  select
end  if
%>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
 <tr>
         <td colspan="2" height="58">
   <%
   if rs.eof then
    response.write "没有栏目:("
   else
    intpagesize=pagesize
    rs.pagesize=intpagesize
    if not rs.eof then
     rs.absolutepage=intcur
    end if
    total=rs.recordcount
    inttotal=rs.pagecount
    dim i
    i = 0
    %>
    <table border = 1 align = center>
     
     <tr>
      <%
      dim n
      n = 0
      do while n <= ubound(args)%>
       <th>
        <%response.write args(n)%>
       </th>
       <%
      n = n + 1
      loop
       %>
     </tr>
     <%
     do while not rs.eof and i<intpagesize%>
     <tr>
      <%
      dim l
      l = 0
      do while l <= ubound(args)
      %>    
      <td>
       <%=rs(args(l))%>
      </td>
      <%
      l = l + 1
      loop
      %>
     </tr>
     <%
     i = i + 1
     rs.movenext
     loop
     %>
    </table>
    <%
   end if%>
  </td>
 </tr>
</table>
<div align="center"><br>
 <%=intcur%> /<%=inttotal%> 
 <%  if intcur>1  then  %>
  <a  href="index.asp?page=previous&curpage=<%=intcur%>">上一页</a>
 <%else%>
  上一页
 <%end if
 intcur=cint(intcur)
 inttotal=cint(inttotal)%>
 <%if intcur<inttotal then%>

本文关键:分页
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top