中国设计联盟
联网
平面设计 画册 VI欣赏 包装 CG-插画 搜索 个人网页 Alexa排名 CSS 建站资源 下载专区 JS特效 品牌服装 服装院校 专题欣赏 SEO 图标欣赏 专题
网站建设 域名注册 虚拟主机 广州网站设计 域名注册 广州网站建设 上海网站建设 虚拟主机 广州网页设计  虚拟主机 域名注册 acg王国 ACG玩家
求创科技
网站建设
中国福网
招聘求职
中国互联
艺魂宝库网
中资源
当前位置:网络学院首页 >> 编程开发 >> asp >> ASP 通用文章分页函数:非记录集分页

ASP 通用文章分页函数:非记录集分页 (2)

来源:中国设计秀    作者:yeur    点击:1496     加入收藏    发表评论
0
顶一下
关键字:教程 asp

        if isNumeric(pSize)=false or len(aStr)=0 then exit function
        if isNull(rId) or rId="" or isNumeric(rId)=false then rId=1 '如果分页查询ID为空则 ID为 1
dim aStrLen '取文章总长度的变量
            aStrLen=len(aStr)
       
        '智能URL字符串替换
        dim rqs, url, rName
            rqs=request.ServerVariables("QUERY_STRING")
            rName="apid"
        if rqs="" then
            url="?"&rName&"="
        elseif instr(rqs,rName)<>0 then   
            url="?"&replace(rqs,rName&"="&rId,"")&rName&"="
        else
            url="?"&replace(rqs,"&"&rName&"="&rId,"")&"&"&rName&"="
        end if
       
        dim tPg '定义总页数变量
            tPg=int(aStrLen/-pSize)*-1
           
        if rId<1 then rId=1 '如果分页查询ID小于1, 则为1
        if cLng(rId)>cLng(tPg) then rId=tPg '如果分页查询ID大于总页数, 则为总页数
           
        dim cPg '定义取当前页字符起始位置变量
        if rId=1 then cPg=1 else cPg=pSize*(rId-1)+1 '读取文章的起始位置
 
        dim dic '字义字典变量
        set dic = createObject("scripting.dictionary")
            if aStrLen<=pSize then '如果分页大小大于正文大小时, 执行以下操作
                dic.add "pgnt", "" '增加页面连接到字典
                   
                '增加统计信息到字典
                dic.add "info", formatNumber(pSize,0)&"字/页 "&rid&"/"&tPg&"页 共"&_
                formatNumber(aStrLen,0)&"字"
               
                dic.add "cnt", mid(aStr,1) '增加内容到字典
                set fAtPgnt=dic
                set dic=nothing
                exit function
            end if
       
            dim i, temp, temp1
            for i=1 to tPg
                '如果当前查询ID=i, 则加入高亮CSS类
                if strComp(rId,i,1)=0 then temp1=" class=""hl"""
temp=temp&"<a href="""&url&i&""""&temp1&">第"&i&"页</a> "
            next
           
            dic.add "pgnt", temp '增加页面连接到字典
 
[1] [2] [3]
2008-03-10 01:22:00    出处:中国设计秀cnwebshow.com
Google
网站地图 | 关于我们 | 联系我们 | 网站建设 | 广告服务 | 版权声明 | 免责声明 | 网站公告 | 友情链接 | 留言 | 旧版入口