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

谁有这样的分页导航代码: 上一页 [1][2][3]...[10]下一页

yzwt2004 发布于 2007-04-17 11:57, 1760 次点击
具体是这样的:

共100条 第1页/共10页 首页 上一页 [1][2][3][4][5][6][7][8][9][10] 下10条 下一页 尾页


这个,谁有???我只要这个导航代码,不要分页的,谢谢
7 回复
#2
lq73506842007-04-17 15:55
产生1\2\3\4\5\6\7\8\9\10这个样子的分页代码
<%
strsql="*****************************************" '这里根据条件自己写
set rs = Server.CreateObject("ADODB.Recordset")
rs.Open strsql, conn, 1, 1
if not rs.eof then
page=12
rs.pagesize=page
maxpage=rs.pagecount
if pageno < 1 then
pageno =1
end if
if pageno+1 >maxpage+1 then
pageno=maxpage
end if
rs.absolutePage=pageno
else
maxpage=1
end if
total = rs.RecordCount
%>
'这里执行for 或do while 或while循环都可以,略了.
<%
'===========================
'产生1\2\3\4\5\6\7\8\9\10 等等
sub pages()
pagelast=pageno+9
if pagelast>=maxpage then
pagelast=maxpage
end if

for i=pageno to pagelast
dim str,link0,link1
link0="<a href="&"product.asp?pageno="&i&">"
link1="</a>"
str="&nbsp;"&link0&i&link1
response.Write str
next
end sub
'通过下拉列表直接跳转
sub selectp()
response.Write "跳转到"&" <form action='product.asp' method='post' ><select name='pageno' onChange='javascript:submit()'>"
for i=1 to maxpage
response.Write "<option value="&i&">"&"第"&i&"页"&"</option>"
next
response.write "</form>"
end sub
%>





这个你看看行不行
#3
gdk20062007-04-17 16:15
测试了一下怎么翻不了呢!还有哪个循环语句的条件是什么啊!

#4
caor19872007-04-17 16:23
先声明,这不是我做的。
上次有人发过了,我这次替他再发下。
只有本站会员才能查看附件,请 登录

#5
lq73506842007-04-17 17:10
以下是引用gdk2006在2007-4-17 16:15:44的发言:
测试了一下怎么翻不了呢!还有哪个循环语句的条件是什么啊!

我还没测试,你再看看吧.
这也是我找的别人的.

#6
メ冰枫ぱ雪2007-04-17 23:01

我是这么写的。。

If psCount > CInt(psCount) Then
psCount = CInt(psCount) + 1
Else
psCount = CInt(psCount)
End If

PageMin = CurrentPage - 2
PageMax = CurrentPage + 2

If PageMin < 1 Then PageMin = 1
If PageMax < 5 Then PageMax = 5
If PageMax > psCount Then PageMax = psCount

Response.Write("共"& rsCount &"条&nbsp;&nbsp;"& CurrentPage &"/"& psCount &"页&nbsp;&nbsp;")

If CurrentPage > 1 Then
Response.Write("<a href='?PageNo=1'>&lt;&lt;</a>&nbsp;")
Response.Write("<a href='?PageNo="& CurrentPage - 1 &"'>&lt;</a>&nbsp;")
Else
Response.Write("&lt;&lt;&nbsp;")
Response.Write("&lt;&nbsp;")
End If

For i = PageMin To PageMax
Response.Write("[<a href='?PageNo="& i &"'>"& i &"</a>]&nbsp;")
Next

If CurrentPage < psCount Then
Response.Write("<a href='?PageNo="& CurrentPage + 1 &"'>&gt;</a>&nbsp;")
Response.Write("<a href='?PageNo="& psCount &"'>&gt;&gt;</a>")
Else
Response.Write("&gt;&nbsp;")
Response.Write("&gt;&gt;")
End If

#7
szchenli2010-06-06 11:13
好,我要了
1