注册 登录
编程论坛 ASP技术论坛

请教一个ASP分页问题?

kira007 发布于 2007-12-21 13:16, 761 次点击
一直以来我的分页模式都是:“ 首页 上一页 下一页 尾页 ”
现在网络上很多分页都比较多采用“上一页 1 2 3 4 5 6 7 8 下一页”这个模式
请问第二种模式 是怎么现实的 ?
2 回复
#2
yms1232007-12-21 17:23
[url]http://bbs.bc-cn.net/viewthread.php?tid=37557&extra=page%3D1%26amp%3Bfilter%3Ddigest[/url]
这个程序楼主看了吗?
上一页 1 2 3 4 5 6 7 8 下一页
其实这个原理就是对页码再进行二次分页。
#3
xmuer2007-12-22 15:32
看看这个
<%sql="select * from news order by news_no desc"
set rs = Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,3,3
If IsNumeric(Request("Page"))=false Or Request("Page")="" Then
                Page=1
            Else
                Page=CInt(Request("Page"))
            End if        
            Rs.PageSize=3    
            If Rs.EOF Or Rs.BOF Then
                Response.Write "目前还没有产品!"&"<br>"
                      Else
                myPageSize=Rs.PageSize
                      Rs.AbsolutePage=Page

%>    
<table>
<%Do While not Rs.Eof And myPageSize>0%>  
<tr><td width=600>                   </td></tr>
 <%    myPageSize=myPageSize-1
            i=i+1
            Rs.MoveNext
            Loop
      %>
</table>
<%end if%>
产品总数:<%=Rs.RecordCount%>个;每页显示:<%=Rs.PageSize%>个;第<%=Page%>页/共<%=Rs.PageCount%>页.            
<%                
If Page > 1 Then
Response.Write "<a href='product.asp?Page=1' title='首页'><font face=webdings>" & 9 & "</font></a>"
Response.Write "&nbsp;<a href='product.asp?Page="&Page-1&"' title='上一页'><font face=webdings>" & 7 & "</font></a>"
End If
For j = 1 To Rs.PageCount         
Response.Write "&nbsp;<a href='product.asp?Page="&j&"'>" & j & "</a>"    
Next
If Page < Rs.PageCount Then
Response.Write "&nbsp;<a href='product.asp?Page="&Page+1&"' title='下一页'><font face=webdings>" & "8" & "</a></font>"
End If
Response.Write "&nbsp;<a href='product.asp?Page="&Rs.PageCount&"' title='尾页'><font face=webdings>:</a>"
%>
<%
Rs.Close
Set Rs=nothing
%>
1