zoukankan      html  css  js  c++  java
  • asp快速开发方法之分页函数

    log_Content
    "自己常用的ASP分页代码,将以下代码放入你的函数文件内,在使用的文件内写上<!--#include file="调用文件.asp" />,可以直接拿来用的!
    在需要调用的位置放上以下语句
    
    
    程序代码
    <%call pageList(总页数,每页行数,当前页,当前页URL,是否显示分页信息)%>
    
    
    
    程序代码
    function pageList(allNum,pagesize,page,pageUrl,showall)
    dim temppage,tempvalue
    
    if Isnumeric(allNum) then
    if int(allNum)<1 then allNum=1 end if
    else
    allNum=1
    end if
    if Isnumeric(pagesize) then
    if int(pagesize)<1 then pagesize=10 end if
    else
    pagesize=10
    end if
    if Isnumeric(page) then
    if int(page)<1 then page=1 end if
    else
    page=1
    end if
    allNum = int(allNum)
    pagesize = int(pagesize)
    page = int(page)
    
    temppage=fix(allNum/pagesize)
    if allNum mod pagesize > 0 then temppage = temppage + 1 end if
    if page>temppage then page=temppage end if
    if pageUrl="" then pageUrl=Request.ServerVariables("SCRIPT_Name") end if
    if instr(pageUrl,"?") = 0 then pageUrl = pageUrl & "?" end if
    if Right(pageUrl,1) = "?" then pageUrl = pageUrl else pageUrl = pageUrl&"&" end if
    if page > 10 then
    tempvalue = tempvalue & "<a href="""&pageUrl&"page=1"" title=""第一页""><span style=""font-family:webdings"">9</span></a> "
    end if
    if page > 1 then
    tempvalue = tempvalue & "<a href="""&pageUrl&"page="&(page-1)&""" title=""上一页""><span style=""font-family:webdings"">3</span></a> "
    end if
    
    for i=1 to 10
    if page-5+i>=1 and page-5+i<=temppage then
    if page = page-5+i then
    tempvalue = tempvalue & page-5+i
    else
    tempvalue = tempvalue & "[<a href="""&pageUrl&"page="&page-5+i&""">"
    tempvalue = tempvalue & page-5+i
    tempvalue = tempvalue & "</a>]"
    end if
    tempvalue = tempvalue & " "
    end if
    next
    
    if page < temppage then
    tempvalue = tempvalue & "<a href="""&pageUrl&"page="&(page+1)&""" title=""下一页""><span style=""font-family:webdings"">4</span></a> "
    end if
    if page < temppage-10 then
    tempvalue = tempvalue & "<a href="""&pageUrl&"page="&temppage&"""><span style=""font-family:webdings"" title=""最后页"">:</span></a> "
    end if
    
    if showall = "all" or showall = true then
    tempvalue = tempvalue & "页次:"&page&"/"&temppage&"页共"&allNum&"条记录 "&pagesize&"条/页"
    end if
    pageList = tempvalue
    end function 
    

      

  • 相关阅读:
    [转][ASP.NET Core 3框架揭秘] 跨平台开发体验: Windows [上篇]
    [转]Jmeter压力测试工具安装及使用教程
    [转]来自后端的逆袭 blazor简介 全栈的福音
    [转]【译】.NET Core 3.0 中的新变化
    [转]Spring历史版本变迁和如今的生态帝国
    [转]SpringBoot整合Swagger2以及生产环境的安全问题处理
    IIS7下,显示PHP错误(不显示500错误,而显示详细错误)
    移动端FastClick和editor冲突问题。
    npm WARN checkPermissions Missing write access to 解决办法
    教你用Cordova打包Vue项目
  • 原文地址:https://www.cnblogs.com/uuxanet/p/3282794.html
Copyright © 2011-2022 走看看