首页 | 站长免费中心 | 新手上路 | 网站运营 | 网页制作 | 图片设计 | 动画设计 | 网页编程 | 网页特效 | 本站专题 | 虚拟主机 | 域名注册 | 网站建设 | 程序下载
       免费空间资源 | 新闻咨询 | 免费域名 | 免费网盘 | 网站推广 | 网站策划 | 建站经验 | 网站优化 | 网页代码 | 源码下载 | 音乐小偷 | 网络赚钱 | 论坛交流
网站建设
网站建设
虚拟主机
虚拟主机
域名注册
域名注册
711网络首页
站长工具
站长工具
网站源码
网站源码
站长论坛
站长论坛

 711网络 网页编程ASP代码

文章内容分页函数

来源: 互联网    日期:2007-1-13 15:10:14
 

    手工分页,自动分页,都可以
    
     [转自:711网络工作室 http://www.tc711.com]

    '=================================================
    '过程名:AutoPagination
    '作  用:采用自动分页方式显示具体的内容
    '参  数:MaxCharPerPage ----- 每页的文件字数
    '        StrAutoId ----- 需要处理的Id
    '        StrAutoIdName ----- Id的名字
    '        StrContent ----- 需要处理的内容
    '=================================================
    sub AutoPagination(MaxCharPerPage,StrAutoId,StrAutoIdName,StrContent)
    dim CurrentPage
    dim ContentLen,MaxPerPage,pages,i,lngBound
    dim BeginPoint,EndPoint
    ContentLen=len(strContent)
    CurrentPage=trim(request("ArticlePage"))
    if ContentLen<=MaxCharPerPage then
    response.write strContent
    else
    if CurrentPage="" then
    CurrentPage=1
    else
    CurrentPage=Cint(CurrentPage)
    end if
    pages=ContentLen\MaxCharPerPage
    if MaxCharPerPage*pages<ContentLen then
    pages=pages+1
    end if
    lngBound=ContentLen          '最大误差范围
    if CurrentPage<1 then CurrentPage=1
    if CurrentPage>pages then CurrentPage=pages
    dim lngTemp
    dim lngTemp1,lngTemp1_1,lngTemp1_2,lngTemp1_1_1,lngTemp1_1_2,lngTemp1_1_3,lngTemp1_2_1,lngTemp1_2_2,lngTemp1_2_3
    dim lngTemp2,lngTemp2_1,lngTemp2_2,lngTemp2_1_1,lngTemp2_1_2,lngTemp2_2_1,lngTemp2_2_2
    dim lngTemp3,lngTemp3_1,lngTemp3_2,lngTemp3_1_1,lngTemp3_1_2,lngTemp3_2_1,lngTemp3_2_2
    dim lngTemp4,lngTemp4_1,lngTemp4_2,lngTemp4_1_1,lngTemp4_1_2,lngTemp4_2_1,lngTemp4_2_2
    dim lngTemp5,lngTemp5_1,lngTemp5_2
    dim lngTemp6,lngTemp6_1,lngTemp6_2
    if CurrentPage=1 then
    BeginPoint=1
    else
    BeginPoint=MaxCharPerPage*(CurrentPage-1)+1
    lngTemp1_1_1=instr(BeginPoint,strContent,"</table>",1)
    lngTemp1_1_2=instr(BeginPoint,strContent,"</TABLE>",1)
    lngTemp1_1_3=instr(BeginPoint,strContent,"</Table>",1)
    if lngTemp1_1_1>0 then
    lngTemp1_1=lngTemp1_1_1
    elseif lngTemp1_1_2>0 then
    lngTemp1_1=lngTemp1_1_2
    elseif lngTemp1_1_3>0 then
    lngTemp1_1=lngTemp1_1_3
    else
    lngTemp1_1=0
    end if
    lngTemp1_2_1=instr(BeginPoint,strContent,"<table",1)
    lngTemp1_2_2=instr(BeginPoint,strContent,"<TABLE",1)
    lngTemp1_2_3=instr(BeginPoint,strContent,"<Table",1)
    if lngTemp1_2_1>0 then
    lngTemp1_2=lngTemp1_2_1
    elseif lngTemp1_2_2>0 then
    lngTemp1_2=lngTemp1_2_2
    elseif lngTemp1_2_3>0 then
    lngTemp1_2=lngTemp1_2_3
    else
    lngTemp1_2=0
    end if
    if lngTemp1_1=0 and lngTemp1_2=0 then
    lngTemp1=BeginPoint
    else
    if lngTemp1_1>lngTemp1_2 then
    lngtemp1=lngTemp1_2
    else
    lngTemp1=lngTemp1_1+8
    end if
    end if
    lngTemp2_1_1=instr(BeginPoint,strContent,"</p>",1)
    lngTemp2_1_2=instr(BeginPoint,strContent,"</P>",1)
    if lngTemp2_1_1>0 then
    lngTemp2_1=lngTemp2_1_1
    elseif lngTemp2_1_2>0 then
    lngTemp2_1=lngTemp2_1_2
    else
    lngTemp2_1=0
    end if
    lngTemp2_2_1=instr(BeginPoint,strContent,"<p",1)
    lngTemp2_2_2=instr(BeginPoint,strContent,"<P",1)
    if lngTemp2_2_1>0 then
    lngTemp2_2=lngTemp2_2_1
    elseif lngTemp2_2_2>0 then
    lngTemp2_2=lngTemp2_2_2
    else
    lngTemp2_2=0
    end if
    if lngTemp2_1=0 and lngTemp2_2=0 then
    lngTemp2=BeginPoint
    else
    if lngTemp2_1>lngTemp2_2 then
    lngtemp2=lngTemp2_2
    else
    lngTemp2=lngTemp2_1+4
    end if
    end if
    lngTemp3_1_1=instr(BeginPoint,strContent,"</ur>",1)
    lngTemp3_1_2=instr(BeginPoint,strContent,"</UR>",1)
    if lngTemp3_1_1>0 then
    lngTemp3_1=lngTemp3_1_1
    elseif lngTemp3_1_2>0 then
    lngTemp3_1=lngTemp3_1_2
    else
    lngTemp3_1=0
    end if
    lngTemp3_2_1=instr(BeginPoint,strContent,"<ur",1)
    lngTemp3_2_2=instr(BeginPoint,strContent,"<UR",1)
    if lngTemp3_2_1>0 then
    lngTemp3_2=lngTemp3_2_1
    elseif lngTemp3_2_2>0 then
    lngTemp3_2=lngTemp3_2_2
    else
    lngTemp3_2=0
    end if
    if lngTemp3_1=0 and lngTemp3_2=0 then
    lngTemp3=BeginPoint
    else
    if lngTemp3_1>lngTemp3_2 then
    lngtemp3=lngTemp3_2
    else
    lngTemp3=lngTemp3_1+5
    end if
    end if
    if lngTemp1<lngTemp2 then
    lngTemp=lngTemp2
    else
    lngTemp=lngTemp1
    end if
    if lngTemp<lngTemp3 then
    lngTemp=lngTemp3
    end if
    if lngTemp>BeginPoint and lngTemp<=BeginPoint+lngBound then
    BeginPoint=lngTemp
    else
    lngTemp4_1_1=instr(BeginPoint,strContent,"</li>",1)
    lngTemp4_1_2=instr(BeginPoint,strContent,"</LI>",1)
    if lngTemp4_1_1>0 then
    lngTemp4_1=lngTemp4_1_1
    elseif lngTemp4_1_2>0 then
    lngTemp4_1=lngTemp4_1_2
    else
    lngTemp4_1=0
    end if
    lngTemp4_2_1=instr(BeginPoint,strContent,"<li",1)
    lngTemp4_2_1=instr(BeginPoint,strContent,"<LI",1)
    if lngTemp4_2_1>0 then
    lngTemp4_2=lngTemp4_2_1
    elseif lngTemp4_2_2>0 then
    lngTemp4_2=lngTemp4_2_2
    else
    lngTemp4_2=0
    end if
    if lngTemp4_1=0 and lngTemp4_2=0 then
    lngTemp4=BeginPoint
    else
    if lngTemp4_1>lngTemp4_2 then
    lngtemp4=lngTemp4_2
    else
    lngTemp4=lngTemp4_1+5
    end if
    end if
     [转自:711网络工作室 http://www.tc711.com]

    


    

    
    if lngTemp4>BeginPoint and lngTemp4<=BeginPoint+lngBound then
    BeginPoint=lngTemp4
    else
    lngTemp5_1=instr(BeginPoint,strContent,"<img",1)
    lngTemp5_2=instr(BeginPoint,strContent,"<IMG",1)
    if lngTemp5_1>0 then
    lngTemp5=lngTemp5_1
    elseif lngTemp5_2>0 then
    lngTemp5=lngTemp5_2
    else
    lngTemp5=BeginPoint
    end if
    if lngTemp5>BeginPoint and lngTemp5<BeginPoint+lngBound then
    BeginPoint=lngTemp5
    else
    lngTemp6_1=instr(BeginPoint,strContent,"<br/>",1)
    lngTemp6_2=instr(BeginPoint,strContent,"<BR>",1)
    if lngTemp6_1>0 then
    lngTemp6=lngTemp6_1
    elseif lngTemp6_2>0 then
    lngTemp6=lngTemp6_2
    else
    lngTemp6=0
    end if
    if lngTemp6>BeginPoint and lngTemp6<BeginPoint+lngBound then
    BeginPoint=lngTemp6+4
    end if
    end if
    end if
    end if
    end if
    if CurrentPage=pages then
    EndPoint=ContentLen
    else
      EndPoint=MaxCharPerPage*CurrentPage
      if EndPoint>=ContentLen then
    EndPoint=ContentLen
      else
    lngTemp1_1_1=instr(EndPoint,strContent,"</table>",1)
    lngTemp1_1_2=instr(EndPoint,strContent,"</TABLE>",1)
    lngTemp1_1_3=instr(EndPoint,strContent,"</Table>",1)
    if lngTemp1_1_1>0 then
    lngTemp1_1=lngTemp1_1_1
    elseif lngTemp1_1_2>0 then
    lngTemp1_1=lngTemp1_1_2
    elseif lngTemp1_1_3>0 then
    lngTemp1_1=lngTemp1_1_3
    else
    lngTemp1_1=0
    end if
    lngTemp1_2_1=instr(EndPoint,strContent,"<table",1)
    lngTemp1_2_2=instr(EndPoint,strContent,"<TABLE",1)
    lngTemp1_2_3=instr(EndPoint,strContent,"<Table",1)
    if lngTemp1_2_1>0 then
    lngTemp1_2=lngTemp1_2_1
    elseif lngTemp1_2_2>0 then
    lngTemp1_2=lngTemp1_2_2
    elseif lngTemp1_2_3>0 then
    lngTemp1_2=lngTemp1_2_3
    else
    lngTemp1_2=0
    end if
    if lngTemp1_1=0 and lngTemp1_2=0 then
    lngTemp1=EndPoint
    else
    if lngTemp1_1>lngTemp1_2 then
    lngtemp1=lngTemp1_2-1
    else
    lngTemp1=lngTemp1_1+7
    end if
    end if
    lngTemp2_1_1=instr(EndPoint,strContent,"</p>",1)
    lngTemp2_1_2=instr(EndPoint,strContent,"</P>",1)
    if lngTemp2_1_1>0 then
    lngTemp2_1=lngTemp2_1_1
    elseif lngTemp2_1_2>0 then
    lngTemp2_1=lngTemp2_1_2
    else
    lngTemp2_1=0
    end if
    lngTemp2_2_1=instr(EndPoint,strContent,"<p",1)
    lngTemp2_2_2=instr(EndPoint,strContent,"<P",1)
    if lngTemp2_2_1>0 then
    lngTemp2_2=lngTemp2_2_1
    elseif lngTemp2_2_2>0 then
    lngTemp2_2=lngTemp2_2_2
    else
    lngTemp2_2=0
    end if
    if lngTemp2_1=0 and lngTemp2_2=0 then
    lngTemp2=EndPoint
    else
    if lngTemp2_1>lngTemp2_2 then
    lngTemp2=lngTemp2_2-1
    else
    lngTemp2=lngTemp2_1+3
    end if
    end if
    lngTemp3_1_1=instr(EndPoint,strContent,"</ur>",1)
    lngTemp3_1_2=instr(EndPoint,strContent,"</UR>",1)
    if lngTemp3_1_1>0 then
    lngTemp3_1=lngTemp3_1_1
    elseif lngTemp3_1_2>0 then
    lngTemp3_1=lngTemp3_1_2
    else
    lngTemp3_1=0
    end if
    lngTemp3_2_1=instr(EndPoint,strContent,"<ur",1)
    lngTemp3_2_2=instr(EndPoint,strContent,"<UR",1)
    if lngTemp3_2_1>0 then
    lngTemp3_2=lngTemp3_2_1
    elseif lngTemp3_2_2>0 then
    lngTemp3_2=lngTemp3_2_2
    else
    lngTemp3_2=0
    end if
    if lngTemp3_1=0 and lngTemp3_2=0 then
    lngTemp3=EndPoint
    else
    if lngTemp3_1>lngTemp3_2 then
    lngtemp3=lngTemp3_2-1
    else
    lngTemp3=lngTemp3_1+4
    end if
    end if
    

    


    

    
    if lngTemp1<lngTemp2 then
    lngTemp=lngTemp2
    else
    lngTemp=lngTemp1
    end if
    if lngTemp<lngTemp3 then
    lngTemp=lngTemp3
    end if
    if lngTemp>EndPoint and lngTemp<=EndPoint+lngBound then
    EndPoint=lngTemp
    else
    lngTemp4_1_1=instr(EndPoint,strContent,"</li>",1)
    lngTemp4_1_2=instr(EndPoint,strContent,"</LI>",1)
    if lngTemp4_1_1>0 then
    lngTemp4_1=lngTemp4_1_1
    elseif lngTemp4_1_2>0 then
    lngTemp4_1=lngTemp4_1_2
    else
    lngTemp4_1=0
    end if
    lngTemp4_2_1=instr(EndPoint,strContent,"<li",1)
    lngTemp4_2_1=instr(EndPoint,strContent,"<LI",1)
    if lngTemp4_2_1>0 then
    lngTemp4_2=lngTemp4_2_1
    elseif lngTemp4_2_2>0 then
    lngTemp4_2=lngTemp4_2_2
    else
    lngTemp4_2=0
    end if
    if lngTemp4_1=0 and lngTemp4_2=0 then
    lngTemp4=EndPoint
    else
    if lngTemp4_1>lngTemp4_2 then
    lngtemp4=lngTemp4_2-1
    else
    lngTemp4=lngTemp4_1+4
    end if
    end if
    if lngTemp4>EndPoint and lngTemp4<=EndPoint+lngBound then
    EndPoint=lngTemp4
    else
    lngTemp5_1=instr(EndPoint,strContent,"<img",1)
    lngTemp5_2=instr(EndPoint,strContent,"<IMG",1)
    if lngTemp5_1>0 then
    lngTemp5=lngTemp5_1-1
    elseif lngTemp5_2>0 then
    lngTemp5=lngTemp5_2-1
    else
    lngTemp5=EndPoint
    end if
    if lngTemp5>EndPoint and lngTemp5<EndPoint+lngBound then
    EndPoint=lngTemp5
    else
    lngTemp6_1=instr(EndPoint,strContent,"<br/>",1)
    lngTemp6_2=instr(EndPoint,strContent,"<BR>",1)
    if lngTemp6_1>0 then
    lngTemp6=lngTemp6_1+3
    elseif lngTemp6_2>0 then
    lngTemp6=lngTemp6_2+3
    else
    lngTemp6=EndPoint
    end if
    if lngTemp6>EndPoint and lngTemp6<EndPoint+lngBound then
    EndPoint=lngTemp6
    end if
    end if
    end if
    end if
      end if
    end if
    response.write mid(strContent,BeginPoint,EndPoint-BeginPoint)
    response.write "</p><p align='center'><b>"
    if CurrentPage>1 then
    response.write "<a href='" & strFileName & "?" & StrAutoIdName & "=" & StrAutoId & "&ArticlePage=" & CurrentPage-1 & "'>上一页</a>  "
    end if
    for i=1 to pages
    if i=CurrentPage then
    response.write "<font color='red'>[" & cstr(i) & "]</font> "
    else
    response.write "<a href='" & strFileName & "?" & StrAutoIdName & "=" & StrAutoId & "&ArticlePage=" & i & "'>[" & i & "]</a> "
    end if
    next
    if CurrentPage<pages then
    response.write " <a href='" & strFileName & "?" & StrAutoIdName & "=" & StrAutoId & "&ArticlePage=" & CurrentPage+1 & "'></a>"
    end if
    response.write "</b></p>"
    end if
    end sub
    



更多的文章内容分页函数请到论坛查看: http://BBS.TC711.COM



【 双击滚屏 】 【 评论 】 【 收藏 】 【 打印 】 【 关闭 】 来源: 互联网    日期:2007-1-13 15:10:14   

发 表 评 论
查看评论

  您的大名:
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款
认证编码: 刷新验证码
点评内容: 字数0
  精品推荐  
  本月推荐  
  友情赞助  

关于我们 | 联系我们 | 广告投放 | 留言反馈 | 免费程序 | 虚拟主机 | 网站建设 |  网站推广 |  google_sitemap baidu_sitemap RSS订阅
本站所有资源均来自互联网,如有侵犯您的版权或其他问题,请通知管理员,我们会在最短的时间回复您
Copyright © 2005-2015 Tc711.Com All Rights Reserved 版权所有·711网络   蜀ICP备05021915号
110网监备案 信息产业备案 不良信息举报