<%
'------------------------------------------------------------
'------------------------------------------------------------
CLASS pagination
PUBLIC pageSize '每页显示多少记录
PUBLIC absolutePage '当前页
PUBLIC baseURL '要跳转的页面的URL
PUBLIC baseQueryString '页面原有的queryString
PUBLIC rst '转换后的记录集
PUBLIC pageListCount '下面列出来多少个页面的。。。
PUBLIC beginPosition '记录从哪里开始
PUBLIC endPosition '
PUBLIC pageListForReturn 'add by jeanun 2008.11.13
PRIVATE sub class_initialize '构造函数。
pageSize =20
absolutePage=request.QueryString("page")
baseURL =request.ServerVariables("URL")
baseQueryString =""
set rst=server.CreateObject("ADODB.RecordSet")
pageListCount =10
dim o
for each o in request.querystring
if o<>"page" then
baseQueryString= baseQueryString & o & "=" & request.querystring(o) & "&"
end if
next
if not isNumeric(absolutePage) then
absolutePage = 1 '不能和下面的判断条件合并在一起,要不然,会提示出错,想不通!
end if
if trim(absolutePage)="" or absolutepage<=0 then
absolutePage =1 '注,不是从0开始的。不信可以试试。
end if
absolutePage=cint(absolutepage)
end sub
PUBLIC SUB setValue(pRst)
set rst=pRst
rst.pageSize =pageSize
if Cint(absolutepage)>rst.pagecount then
absolutepage=rst.pagecount
end if
if not rst.eof then
rst.absolutePage=absolutePage
beginPosition =rst.absoluteposition
else
beginPosition =0
end if
endPosition =beginPosition+pagesize-1
if endPosition>rst.recordcount then
endPosition=rst.recordcount
end if
END SUB
PUBLIC SUB pageList
if rst.recordcount>0 then
dim startNum
startNum=int((absolutePage-1)/pageListCount)*pageListCount+1
'公式:int((n-1)/col)*col+1 n给定的参数 col每行显示几个数字 从1开始,顺序排
if absolutepage<>1 then
response.write("|<")
end if
if startNum-pageListCount>0 then
response.write("<<")
end if
for i=startNum to startNum+pageListCount-1
if i=absolutepage then
className="activePage"
else
className="inactivePage"
end if
response.write(""&i&"")
if i>=rst.pageCount then
exit for
end if
Next
if startNum+pageListCount<=rst.pageCount then
response.write(">>")
end if
if absolutepage<>rst.pagecount then
response.write(">|")
end if
END IF
End Sub
Public Sub pageList4Return
if rst.recordcount>0 then
dim startNum
startNum=int((absolutePage-1)/pageListCount)*pageListCount+1
'公式:int((n-1)/col)*col+1 n给定的参数 col每行显示几个数字 从1开始,顺序排
if absolutepage<>1 then
pageListForReturn = "|<"
end if
if startNum-pageListCount>0 then
pageListForReturn = pageListForReturn & "<<"
end if
for i=startNum to startNum+pageListCount-1
if i=absolutepage then
className="activePage"
else
className="inactivePage"
end if
pageListForReturn = pageListForReturn & ""&i&""
if i>=rst.pageCount then
exit for
end if
Next
if startNum+pageListCount<=rst.pageCount then
pageListForReturn = pageListForReturn & ">>"
end if
if absolutepage<>rst.pagecount then
pageListForReturn = pageListForReturn & ">|"
end if
pageListForReturn = pageListForReturn & " Go!"
END IF
END Sub
END CLASS
%>
调用上面分页类型的方法
共 <%=myPagination.rst.recordcount %> 条记录 当前 <%=myPagination.absolutepage%>/<%=myPagination.rst.pagecount%> 页 <% myPagination.pageList %> |
敢达决战官方正版 安卓版v6.7.9
下载敢达决战 安卓版v6.7.9
下载像素火影骨架佐助 (Perseverance Fire Shadow)手机版v1.16
下载要塞英雄 安卓版v33.20.0-39082670-Android
下载梦想城镇vivo最新版本 安卓版v12.0.1
梦想城镇vivo版是这款卡通风模拟经营类手游的渠道服版本,玩
怦然心动的瞬间 安卓版v1.0
怦然心动的瞬间是一款真人向的恋爱互动游戏,在游戏中玩家将扮演
曼尼汉堡店游戏 安卓版v1.0.3
曼尼汉堡店是一款非常好玩的精品恐怖类型冒险游戏,在这款游戏中
现代总统模拟器去广告版 安卓版v1.0.46
现代总统模拟器是一款休闲养成类游戏,可能对于不少的玩家来说都
现代总统模拟器付费完整版 安卓版v1.0.46
现代总统模拟器高级版在商店是需要付费的,相对于普通版本,高级