加入收藏 | 设为首页 | 会员中心 | 我要投稿 银川站长网 (https://www.0951zz.com/)- 云通信、基础存储、云上网络、机器学习、视觉智能!
当前位置: 首页 > 站长学院 > Asp教程 > 正文

ShowPage 显露 上一页 下一页 等信息的封装代码

发布时间:2023-05-30 11:20:49 所属栏目:Asp教程 来源:
导读:ShowPage 显露 上一页 下一页 等信息的封装代码:'**************************************************'函数名:ShowPage'作 用:显示“上一页 下一页”等信息'参 数:sFileName ----

ShowPage 显露 上一页 下一页 等信息的封装代码:

'**************************************************

'函数名: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 & "下一页 尾页"

(编辑:银川站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章