kellynic写的一个分页模块
来源:互联网 发布:java测试书籍推荐 知乎 编辑:程序博客网 时间:2024/05/20 00:49
kellynic写的一个分页模块
作者:dadait 日期:2005-10-31
还可以,给大家参考
程序代码
<%
'显示上下页(当前页,总页数,前后加起来的页数,除去cp参数的GET串)
function showPage(currentPage,countPage,showPageC,queryStr)
dim i,l,starF,endF,reStr,getStr
const DOT="<span style=cursor:hand;>..</span>"
l=showPageC2
if currentPage-l<=1 then
starF=1
else
starF=currentPage-l
reStr=reStr & DOT
end if
endF=starF+showPageC
for i=starF to endF
if i>countPage then exit for
if queryStr="" then
getStr="cp=" & i
else
getStr=queryStr & "&cp=" & i
end if
if i<>currentPage then
reStr=reStr & "<a href="/"?" & getStr & """ target=_self class=page>[" & i & "]</a> "
else
reStr=reStr & "<b><font color=#CC9933>[" & i & "]</a></b> "
end if
next
if endF<countPage then reStr=reStr & DOT
reStr=reStr & "<span class=green> " & currentPage & "/" & countPage & " " & showTablePageSize & "/页</span> "
'*****************************************************
if queryStr="" then
getStr="cp=1"
else
getStr=queryStr & "&cp=1"
end if
if currentPage>1 then
reStr=reStr & "<a href="/"?" & getStr & """ target=_self class=page>首页</a> "
else
reStr=reStr & "<font color=#CCCCCC>首页</font> "
end if
'*****************************************************
if queryStr="" then
getStr="cp=" & (currentPage-1)
else
getStr=queryStr & "&cp=" & (currentPage-1)
end if
if currentPage>1 then
reStr=reStr & "<a href="/"?" & getStr & """ target=_self class=page>上页</a> "
else
reStr=reStr & "<font color=#CCCCCC>上页</font> "
end if
'*****************************************************
if queryStr="" then
getStr="cp=" & (currentPage+1)
else
getStr=queryStr & "&cp=" & (currentPage+1)
end if
if currentPage<countPage then
reStr=reStr & "<a href="/"?" & getStr & """ target=_self class=page>下页</a> "
else
reStr=reStr & "<font color=#CCCCCC>下页</font> "
end if
'*****************************************************
if queryStr="" then
getStr="cp=" & countPage
else
getStr=queryStr & "&cp=" & countPage
end if
if currentPage<countPage then
reStr=reStr & "<a href="/"?" & getStr & """ target=_self class=page>末页</a> "
else
reStr=reStr & "<font color=#CCCCCC>末页</font> "
end if
'*****************************************************
showPage=reStr
end function
'过滤所有的GET串中的cp(当前页数据值),保留其它参数值
function allQueryString()
dim queryTemp,queryT,query
queryTemp = Request.ServerVariables("QUERY_STRING")
if queryTemp <> "" then
if instr(queryTemp,"&")<>0 then
queryTemp = split(queryTemp,"&")
dim queryI
for queryI = LBound(queryTemp) to UBound(queryTemp)
queryT = split(queryTemp(queryI),"=")
if queryT(0)<>"cp" then
query = query & queryTemp(queryI) & "&"
end if
next
query = left(query,len(query)-1)
else
queryTemp = split(queryTemp,"=")
if queryTemp(0)<>"cp" then
query = queryTemp(0) & "=" & queryTemp(1)
end if
end if
end if
allQueryString = query
end function
'数据显示完毕后只需这两行代码即可,通用性还可以
query = allQueryString()
response.Write(showPage(showTableCurrentPage,showTableCountPage,9,query))
%>
<%
'显示上下页(当前页,总页数,前后加起来的页数,除去cp参数的GET串)
function showPage(currentPage,countPage,showPageC,queryStr)
dim i,l,starF,endF,reStr,getStr
const DOT="<span style=cursor:hand;>..</span>"
l=showPageC2
if currentPage-l<=1 then
starF=1
else
starF=currentPage-l
reStr=reStr & DOT
end if
endF=starF+showPageC
for i=starF to endF
if i>countPage then exit for
if queryStr="" then
getStr="cp=" & i
else
getStr=queryStr & "&cp=" & i
end if
if i<>currentPage then
reStr=reStr & "<a href="/"?" & getStr & """ target=_self class=page>[" & i & "]</a> "
else
reStr=reStr & "<b><font color=#CC9933>[" & i & "]</a></b> "
end if
next
if endF<countPage then reStr=reStr & DOT
reStr=reStr & "<span class=green> " & currentPage & "/" & countPage & " " & showTablePageSize & "/页</span> "
'*****************************************************
if queryStr="" then
getStr="cp=1"
else
getStr=queryStr & "&cp=1"
end if
if currentPage>1 then
reStr=reStr & "<a href="/"?" & getStr & """ target=_self class=page>首页</a> "
else
reStr=reStr & "<font color=#CCCCCC>首页</font> "
end if
'*****************************************************
if queryStr="" then
getStr="cp=" & (currentPage-1)
else
getStr=queryStr & "&cp=" & (currentPage-1)
end if
if currentPage>1 then
reStr=reStr & "<a href="/"?" & getStr & """ target=_self class=page>上页</a> "
else
reStr=reStr & "<font color=#CCCCCC>上页</font> "
end if
'*****************************************************
if queryStr="" then
getStr="cp=" & (currentPage+1)
else
getStr=queryStr & "&cp=" & (currentPage+1)
end if
if currentPage<countPage then
reStr=reStr & "<a href="/"?" & getStr & """ target=_self class=page>下页</a> "
else
reStr=reStr & "<font color=#CCCCCC>下页</font> "
end if
'*****************************************************
if queryStr="" then
getStr="cp=" & countPage
else
getStr=queryStr & "&cp=" & countPage
end if
if currentPage<countPage then
reStr=reStr & "<a href="/"?" & getStr & """ target=_self class=page>末页</a> "
else
reStr=reStr & "<font color=#CCCCCC>末页</font> "
end if
'*****************************************************
showPage=reStr
end function
'过滤所有的GET串中的cp(当前页数据值),保留其它参数值
function allQueryString()
dim queryTemp,queryT,query
queryTemp = Request.ServerVariables("QUERY_STRING")
if queryTemp <> "" then
if instr(queryTemp,"&")<>0 then
queryTemp = split(queryTemp,"&")
dim queryI
for queryI = LBound(queryTemp) to UBound(queryTemp)
queryT = split(queryTemp(queryI),"=")
if queryT(0)<>"cp" then
query = query & queryTemp(queryI) & "&"
end if
next
query = left(query,len(query)-1)
else
queryTemp = split(queryTemp,"=")
if queryTemp(0)<>"cp" then
query = queryTemp(0) & "=" & queryTemp(1)
end if
end if
end if
allQueryString = query
end function
'数据显示完毕后只需这两行代码即可,通用性还可以
query = allQueryString()
response.Write(showPage(showTableCurrentPage,showTableCountPage,9,query))
%>
- kellynic写的一个分页模块
- 自己写的一个分页
- 写一个模块的步骤:
- javascript下写的一个分页模板
- 我写的一个自定义分页标签
- 自己写的一个分页程序
- 自己写的一个分页程序
- 用户Hibernate写的一个分页
- flex as3 写的一个分页控件
- 写了一个分页通用的
- 用Jquery写的一个分页插件
- Oralce 写一个分页的存储过程
- 自己写的一个php分页类
- 如何写一个简单的分页
- 自己写的一个分页效果
- 最近写的一个分页数据显示及分页导航
- 照着百度的分页写了一个分页条
- Linux--写一个简单的模块
- 又买了一本《深入浅出设计模式》的书,唉。。。
- 理解REST软件架构(转自InfoQ)
- JS中使用正则表达式和常用正则表达式
- 测试phoneme advance(DirectFB)运行环境
- 用MMAPI拍照
- kellynic写的一个分页模块
- 交叉编译场景分析(arm-linux)(七)--编译sqlite
- 交叉编译场景分析(arm-linux)(八)--编译glib
- 超级NB的表格操作
- 35岁后我们能够做什么
- 如何彻底删除VSTS上的项目
- JS的正则表达式详解
- 18girl,girl,18girl电影
- Matlab:元素平移