分享一個asp分頁函數感覺挺好看的視圖如圖
可以根據自己的情況修改代碼
<%
謝亮修分頁程序
call pagecontrol(記錄總數頁碼總數當前頁)
Sub PageControl(iCountpagecountpage)
responseWrite("<style type=""text/css"">/*謝亮分頁CSS*/divpager{padding:px;}divpager adivpager span{padding:px px;margin:px;fontfamily:""宋體"";border:px # solid;}divpager a {textdecoration:none}divpager a:hover {color:#;backgroundcolor:#}divpager spancurrent {fontweight:bold;color:#fff;backgroundcolor:#}divpager spandisabled {border:px #ccc solid;}</style>") &chr()
Dim query a x temp
action = "http://" & RequestServerVariables("HTTP_HOST") & RequestServerVariables("SCRIPT_NAME")
query = Split(RequestServerVariables("QUERY_STRING") "&")
For Each x In query
a = Split(x "=")
If StrComp(a() "page" vbTextCompare) <> Then
temp = temp & a() & "=" & a() & "&"
End If
Next
responseWrite("<div class=""pager"">")&chr()
ResponseWrite("<span class=""disabled"">" & page & "/" & pageCount & "頁</span>")&chr()
ResponseWrite("<span class=""disabled"">共" & iCount & "條記錄</span>")&chr()
if pagecount<= then
for xl= to pagecount
if page=xl then
responseWrite("<span class=current>"&xl&"</span>")&chr()
else
ResponseWrite("<a " & action & "?" & temp & "Page="&xl&">"&xl&"</a> ")&chr()
end if
next
else
if page= then
responseWrite("<span class=current></span>")&chr()
else
ResponseWrite("<a " & action & "?" & temp & "Page=></a> ")&chr()
end if
if page> then ResponseWrite("<span class=""disabled""></span>")&chr()
if page< then i= else i=page
if page > (pagecount) then i=pagecount else i=page+
for xll=i to i
if xll<> and xll <> pagecount then
if xll=page then
responseWrite("<span class=current>"&xll&"</span>")&chr()
else
ResponseWrite("<a href=""" & action & "?" & temp & "Page="&xll&""">"&xll&"</a>")&chr()
end if
end if
next
if page< (pagecount) then ResponseWrite("<span class=""disabled""></span>") &chr()
if page=pagecount then responseWrite("<span class=current>"&pagecount&"</span>")&chr() else ResponseWrite("<a " & action & "?" & temp & "Page="&pagecount&">"&pagecount&"</a> ") &chr()
end if
responseWrite("</div>")&chr()
End Sub
%>
From:http://tw.wingwit.com/Article/program/net/201311/14450.html