手机
当前位置:查字典教程网 >编程开发 >ASP教程 >一个实用asp分页函数
一个实用asp分页函数
摘要:分享一个asp分页函数,感觉挺好看的。视图如图:可以根据自己的情况修改,代码:4thenResponse.Write("...")&chr(...

分享一个asp分页函数,感觉挺好看的。视图如图:

一个实用asp分页函数1

可以根据自己的情况修改,代码:

<%
'谢亮修分页程序
'call pagecontrol(记录总数,页码总数,当前页)
Sub PageControl(iCount,pagecount,page)
response.Write("<style type=""text/css"">/*谢亮分页CSS*/div.pager{padding:10px;}div.pager a,div.pager span{padding:2px 5px;margin:2px;font-family:""宋体"";border:1px #363 solid;}div.pager a {text-decoration:none}div.pager a:hover {color:#000;background-color:#363}div.pager span.current {font-weight:bold;color:#fff;background-color:#363}div.pager span.disabled {border:1px #ccc solid;}</style>") &chr(13)
Dim query, a, x, temp
action = "" & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("SCRIPT_NAME")
query = Split(Request.ServerVariables("QUERY_STRING"), "&")
For Each x In query
a = Split(x, "=")
If StrComp(a(0), "page", vbTextCompare) <> 0 Then
temp = temp & a(0) & "=" & a(1) & "&"
End If
Next
response.Write("<div class=""pager"">")&chr(13)
Response.Write("<span class=""disabled"">" & page & "/" & pageCount & "页</span>")&chr(13)
Response.Write("<span class=""disabled"">共" & iCount & "条记录</span>")&chr(13)
if pagecount<=6 then
for xl=1 to pagecount
if page=xl then
response.Write("<span class='current'>"&xl&"</span>")&chr(13)
else
Response.Write("<a href='" & action & "?" & temp & "Page="&xl&"'>"&xl&"</a> ")&chr(13)
end if
next
else
if page=1 then
response.Write("<span class='current'>1</span>")&chr(13)
else
Response.Write("<a href='" & action & "?" & temp & "Page=1'>1</a> ")&chr(13)
end if
if page>4 then Response.Write("<span class=""disabled"">...</span>")&chr(13)
if page<5 then i1=1 else i1=page-2
if page > (pagecount-4) then i2=pagecount else i2=page+3
for xll=i1 to i2

if xll<>1 and xll <> pagecount then
if xll=page then
response.Write("<span class='current'>"&xll&"</span>")&chr(13)
else
Response.Write("<a href=""" & action & "?" & temp & "Page="&xll&""">"&xll&"</a>")&chr(13)
end if
end if

next
if page< (pagecount-4) then Response.Write("<span class=""disabled"">...</span>") &chr(13)
if page=pagecount then response.Write("<span class='current'>"&pagecount&"</span>")&chr(13) else Response.Write("<a href='" & action & "?" & temp & "Page="&pagecount&"'>"&pagecount&"</a> ") &chr(13)
end if
response.Write("</div>")&chr(13)
End Sub
%>

【一个实用asp分页函数】相关文章:

ASP常用函数收藏乱七八糟未整理版

asp:生成静态页面函数

一种理论上最快的Web数据库分页方法

asp实现表格3列5行

[转]ASP常用函数:TimeZone

ASP FSO文件处理函数大全

asp写入记录

小偷,采集程序常用函数

asp 常用的字符串处理函数

ASP 中使用 HTTP 协议发送参数详解

精品推荐
分类导航