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 
    

      

  • 相关阅读:
    source命令
    [电脑配置]屏幕扩展过,找不到界面
    [SAS]方便查询Tips
    [Excel]方便查询Tips
    [SAS]运用函数等的一些问题
    [SAS]错误整理
    [SAS]易错例子之数值型转字符型
    [R]Precedence
    [sas]Missing Value
    [SAS]
  • 原文地址:https://www.cnblogs.com/uuxanet/p/3282794.html
Copyright © 2011-2022 走看看