ASP分頁Function
Public Sub Pagination2(PageCount,UrlStr = "")
Dim WzPage, PageNum
If UrlStr = "" Then
If Len(Request("Page")) <> 0 Then
WzPage = CLng(Request("Page"))
Else
WzPage = 1
End If
If WzPage <= 0 Then WzPage = 1
PageNum = (WzPage \ 10) * 10 + 1
If WzPage Mod 10 = 0 Then PageNum = (WzPage \ 10) * 10 - 9
Response.Write("<font face=""Webdings"">")
Response.Write("<a href=""?Page=1"" title=""首頁"">9</a>")
Response.Write("<a href=""?Page=" & PageNum - 1 & """ title=""前十頁"">7</a>")
Response.Write("</font><font face=""Arial"">")
For PageNum = PageNum To PageNum + 9
If PageNum = WzPage Then
Response.Write("<b>")
Response.Write(" [" & PageNum & "] ")
Response.Write("</b>")
Else
Response.Write(" <a href=""?Page=" & PageNum & """>")
Response.Write("" & PageNum & "")
Response.Write("</a> ")
End If
If PageNum >= PageCount Then Exit For
Next
Response.Write("</font><font face=""Webdings"">")
Response.Write("<a href=""?Page=" & PageNum & """ title=""後十頁"">8</a>")
Response.Write("<a href=""?Page=" & PageCount & """ title=""尾頁"">:</a>")
Response.Write("</font>")
Else
If Len(Request("Page")) <> 0 Then
WzPage = CLng(Request("Page"))
Else
WzPage = 1
End If
If WzPage <= 0 Then WzPage = 1
PageNum = (WzPage \ 10) * 10 + 1
If WzPage Mod 10 = 0 Then PageNum = (WzPage \ 10) * 10 - 9
Response.Write("<font face=""Webdings"">")
Response.Write("<a href=""?" & UrlStr & "&Page=1"" title=""首頁"">9</a>")
Response.Write("<a href=""?" & UrlStr & "&Page=" & PageNum - 1 & """ title=""前十頁"">7</a>")
Response.Write("</font><font face=""Arial"">")
For PageNum = PageNum To PageNum + 9
If PageNum = WzPage Then
Response.Write("<b>")
Response.Write(" [" & PageNum & "] ")
Response.Write("</b>")
Else
Response.Write(" <a href=""?" & UrlStr & "&Page=" & PageNum & """>")
Response.Write("" & PageNum & "")
Response.Write("</a> ")
End If
If PageNum >= PageCount Then Exit For
Next
Response.Write("</font><font face=""Webdings"">")
Response.Write("<a href=""?" & UrlStr & "&Page=" & PageNum & """ title=""後十頁"">8</a>")
Response.Write("<a href=""?" & UrlStr & "&Page=" & PageCount & """ title=""尾頁"">:</a>")
Response.Write("</font>")
End If
End Sub
Dim WzPage, PageNum
If UrlStr = "" Then
If Len(Request("Page")) <> 0 Then
WzPage = CLng(Request("Page"))
Else
WzPage = 1
End If
If WzPage <= 0 Then WzPage = 1
PageNum = (WzPage \ 10) * 10 + 1
If WzPage Mod 10 = 0 Then PageNum = (WzPage \ 10) * 10 - 9
Response.Write("<font face=""Webdings"">")
Response.Write("<a href=""?Page=1"" title=""首頁"">9</a>")
Response.Write("<a href=""?Page=" & PageNum - 1 & """ title=""前十頁"">7</a>")
Response.Write("</font><font face=""Arial"">")
For PageNum = PageNum To PageNum + 9
If PageNum = WzPage Then
Response.Write("<b>")
Response.Write(" [" & PageNum & "] ")
Response.Write("</b>")
Else
Response.Write(" <a href=""?Page=" & PageNum & """>")
Response.Write("" & PageNum & "")
Response.Write("</a> ")
End If
If PageNum >= PageCount Then Exit For
Next
Response.Write("</font><font face=""Webdings"">")
Response.Write("<a href=""?Page=" & PageNum & """ title=""後十頁"">8</a>")
Response.Write("<a href=""?Page=" & PageCount & """ title=""尾頁"">:</a>")
Response.Write("</font>")
Else
If Len(Request("Page")) <> 0 Then
WzPage = CLng(Request("Page"))
Else
WzPage = 1
End If
If WzPage <= 0 Then WzPage = 1
PageNum = (WzPage \ 10) * 10 + 1
If WzPage Mod 10 = 0 Then PageNum = (WzPage \ 10) * 10 - 9
Response.Write("<font face=""Webdings"">")
Response.Write("<a href=""?" & UrlStr & "&Page=1"" title=""首頁"">9</a>")
Response.Write("<a href=""?" & UrlStr & "&Page=" & PageNum - 1 & """ title=""前十頁"">7</a>")
Response.Write("</font><font face=""Arial"">")
For PageNum = PageNum To PageNum + 9
If PageNum = WzPage Then
Response.Write("<b>")
Response.Write(" [" & PageNum & "] ")
Response.Write("</b>")
Else
Response.Write(" <a href=""?" & UrlStr & "&Page=" & PageNum & """>")
Response.Write("" & PageNum & "")
Response.Write("</a> ")
End If
If PageNum >= PageCount Then Exit For
Next
Response.Write("</font><font face=""Webdings"">")
Response.Write("<a href=""?" & UrlStr & "&Page=" & PageNum & """ title=""後十頁"">8</a>")
Response.Write("<a href=""?" & UrlStr & "&Page=" & PageCount & """ title=""尾頁"">:</a>")
Response.Write("</font>")
End If
End Sub
申明
非源创博文中的内容均收集自网上,若有侵权之处,请及时联络,我会在第一时间内删除.再次说声抱歉!!!
博文欢迎转载,但请给出原文连接。