ShowPage显示“上一页下一页”等信息的封装代码
2023-06-13 09:13:57 时间
"**************************************************
"函数名:ShowPage
"作 用:显示“上一页 下一页”等信息
"参 数:sFileName ----链接地址
" TotalNumber ----总数量
" MaxPerPage ----每页数量
" ShowTotal ----是否显示总数量
" ShowAllPages ---是否用下拉列表显示所有页面以供跳转。有某些页面不能使用,否则会出现JS错误。
" strUnit ----计数单位
"返回值:“上一页 下一页”等信息的HTML代码
"**************************************************
function ShowPage(sFileName,TotalNumber,MaxPerPage,ShowTotal,ShowAllPages,strUnit)
dim TotalPage,strTemp,strUrl,i
if TotalNumber=0 or MaxPerPage=0 or isNull(MaxPerPage) then
ShowPage=""
exit function
end if
if totalnumber mod maxperpage=0 then
TotalPage= totalnumber \ maxperpage
Else
TotalPage= totalnumber \ maxperpage+1
end if
if CurrentPage>TotalPage then CurrentPage=TotalPage
strTemp= "<table align="center"><tr><td>"
if ShowTotal=true then
strTemp=strTemp & "共 <b>" & totalnumber & "</b> " & strUnit & " "
end if
strUrl=JoinChar(sfilename)
if CurrentPage<2 then
strTemp=strTemp & "首页 上一页 "
Else
strTemp=strTemp & "<a href="" & strUrl & "page=1">首页</a> "
strTemp=strTemp & "<a href="" & strUrl & "page=" & (CurrentPage-1) & "">上一页</a> "
end if
if CurrentPage>=TotalPage then
strTemp=strTemp & "下一页 尾页"
Else
strTemp=strTemp & "<a href="" & strUrl & "page=" & (CurrentPage+1) & "">下一页</a> "
strTemp=strTemp & "<a href="" & strUrl & "page=" & TotalPage & "">尾页</a>"
end if
strTemp=strTemp & " 页次:<strong><font color=red>" & CurrentPage & "</font>/" & TotalPage & "</strong>页 "
strTemp=strTemp & " <b>" & maxperpage & "</b>" & strUnit & "/页"
if ShowAllPages=True then
strTemp=strTemp & " 转到第<input type="text" name="page" size="3" maxlength="5" value="" & CurrentPage & "" onKeyPress=""if (event.keyCode==13) window.location="" & strUrl & "page=" & ""+this.value;""">页"
"strTemp = strTemp &" <Input type=""button"" onClick=""window.location.href="" & strUrl & "page="+document.all.page.value;"" name=button1 value=GO >"
end if
strTemp=strTemp & "</td></tr></table>"
ShowPage=strTemp
end function
"函数名:ShowPage
"作 用:显示“上一页 下一页”等信息
"参 数:sFileName ----链接地址
" TotalNumber ----总数量
" MaxPerPage ----每页数量
" ShowTotal ----是否显示总数量
" ShowAllPages ---是否用下拉列表显示所有页面以供跳转。有某些页面不能使用,否则会出现JS错误。
" strUnit ----计数单位
"返回值:“上一页 下一页”等信息的HTML代码
"**************************************************
function ShowPage(sFileName,TotalNumber,MaxPerPage,ShowTotal,ShowAllPages,strUnit)
dim TotalPage,strTemp,strUrl,i
if TotalNumber=0 or MaxPerPage=0 or isNull(MaxPerPage) then
ShowPage=""
exit function
end if
if totalnumber mod maxperpage=0 then
TotalPage= totalnumber \ maxperpage
Else
TotalPage= totalnumber \ maxperpage+1
end if
if CurrentPage>TotalPage then CurrentPage=TotalPage
strTemp= "<table align="center"><tr><td>"
if ShowTotal=true then
strTemp=strTemp & "共 <b>" & totalnumber & "</b> " & strUnit & " "
end if
strUrl=JoinChar(sfilename)
if CurrentPage<2 then
strTemp=strTemp & "首页 上一页 "
Else
strTemp=strTemp & "<a href="" & strUrl & "page=1">首页</a> "
strTemp=strTemp & "<a href="" & strUrl & "page=" & (CurrentPage-1) & "">上一页</a> "
end if
if CurrentPage>=TotalPage then
strTemp=strTemp & "下一页 尾页"
Else
strTemp=strTemp & "<a href="" & strUrl & "page=" & (CurrentPage+1) & "">下一页</a> "
strTemp=strTemp & "<a href="" & strUrl & "page=" & TotalPage & "">尾页</a>"
end if
strTemp=strTemp & " 页次:<strong><font color=red>" & CurrentPage & "</font>/" & TotalPage & "</strong>页 "
strTemp=strTemp & " <b>" & maxperpage & "</b>" & strUnit & "/页"
if ShowAllPages=True then
strTemp=strTemp & " 转到第<input type="text" name="page" size="3" maxlength="5" value="" & CurrentPage & "" onKeyPress=""if (event.keyCode==13) window.location="" & strUrl & "page=" & ""+this.value;""">页"
"strTemp = strTemp &" <Input type=""button"" onClick=""window.location.href="" & strUrl & "page="+document.all.page.value;"" name=button1 value=GO >"
end if
strTemp=strTemp & "</td></tr></table>"
ShowPage=strTemp
end function
相关文章
- 大家都能看得懂的源码之 ahooks useVirtualList 封装虚拟滚动列表
- 贴片电阻封装与功率对照表_贴片电阻能承受多大电流
- 「Python」面向对象封装案例3——士兵突击(需求分析、代码演练)
- 005 Java面向对象知识点 抽象 封装 继承 多态 命名方式 JavaDoc文档 方法的调用 包的作用「建议收藏」
- Redisson简单实现redis分布锁并封装
- highcharts移动端使用-支持vue-支持横向滚动-代码封装
- 批量采集淘宝商品详情数据接口,商品价格,商品销量,商品优惠券,商品视频数据接口封装代码教程
- python对MySqldb模块的简单封装代码详解编程语言
- javascript组件封装中一段通用代码解读详解编程语言
- PHP封装、继承和多态
- 深入理解Linux C封装,提升代码可读性和可维护性。(linuxc封装)
- PHP封装Redis:提高工作效率(封装php redis)
- Oracle中的包实现代码整合与封装高效利用(oracle中的包是啥)
- 用VB生成DLL封装ASP连接数据库的代码
- JavaScript封装Ajax传递的数据代码
- 封装一个PDO数据库操作类代码
- javascript面向对象全新理练之数据的封装
- js操作textarea方法集合封装(兼容IE,firefox)
- javascript全局变量封装模块实现代码
- js封装cookie操作的函数代码
- 封装的jquery翻页滚动(示例代码)
- C#常用字符串加密解密方法封装代码
- python解析xml模块封装代码
- Javascript封装DOMContentLoaded事件实例
- C++选择文件夹代码的封装