网站首页 手机版
 注册 登录
您现在的位置: 畅无忧设计 >> 网络编程 >> ASP教程 >> 正文
最新文章
· FSO 组件asp生成html静态页面碰到缓存
· asp实现长文章自动分页插件
· 在ASP中访问和更新Cookies集合
· ASP错误提示大全
· 学习ASP的几个观点
· ASP用两级联动下拉列表来显示大类和小
· ASP取当前页面地址和参数
· ASP删除记录的同时删除相关图片
· asp将查询结果导出到excel
· ASP批量导入Excel到Access或者Sql Se
热门文章
 化境ASP无组件上传类 - upload_5xs
 一个获取ACCESS数据库表名以及表名
 asp将查询结果导出到excel
 艾恩ASP无组件上传修改版
 ASP批量导入Excel到Access或者Sql 
 ASP读取数据库的Flash+JS图片切换特
 ASP用两级联动下拉列表来显示大类和
 ASP+JS实现网页歌曲连播、点播功能
 使用ASP重启服务器
 asp批量替换access数据库中指定字段
相关文章
没有相关文章
ASP实现单篇文章自动分页函数
来源:你我一起舞 更新时间:2009/5/14 17:04:32 阅读次数:
字体:[ ] 我要投稿
Function AutoSplitPages(StrNewsContent)
Dim Inti,StrTrueContent,iPageLen,DLocation,XLocation,FoundStrpowered by 25175.net
 If StrNewsContent<>"" and AutoPagesNum<>0 and instr(1,StrNewsContent,"$Page_Split_page$")=0 then
  Inti=instr(1,StrNewsContent,"<")
  If inti>=1 then '新闻中存在Html标记
   StrTrueContent=left(StrNewsContent,Inti-1)
   iPageLen=IStrLen(StrTrueContent)
   inti=inti+1
  Else   '新闻中不存在Html标记,对内容直接分页即可
   dim i,c,t
   do while i< len(StrNewsContent)
   i=i+1
    c=Abs(Asc(Mid(StrNewsContent,i,1)))
    if c>255 then '判断为汉字则为两个字符,英文为一个字符
     t=t+2
    else
     t=t+1
    end if
    if t>=AutoPagesNum then  '如果字数达到了分页的数量则插入分页符号
     StrNewsContent=left(StrNewsContent,i)&"$Page_Split_page$"&mid(StrNewsContent,i+1)
     i=i+6
     t=0
    end if
   loop
   AutoSplitPages=StrNewsContent '返回插入分页符号的内容
   Exit Function
  End If
  iPageLen=0
新闻中存在Html标记时,则用下面的语句来处理
  
do while instr(Inti,StrNewsContent,">")<>0
   DLocation=instr(Inti,StrNewsContent,">")  '只计算Html标记之外的字符数量
   XLocation=instr(DLocation,StrNewsContent,"<")
   If XLocation>DLocation+1 then
    Inti=XLocation
    StrTrueContent=mid(StrNewsContent,DLocation+1,XLocation-DLocation-1)
    iPageLen=iPageLen+IStrLen(StrTrueContent) '统计Html之外的字符的数量
    If iPageLen>AutoPagesNum then    '如果达到了分页的数量则插入分页字符
     FoundStr=Lcase(left(StrNewsContent,XLocation-1))
     If AllowSplitPages(FoundStr,"table|a|b>|i>|strong|div")=true then
      StrNewsContent=left(StrNewsContent,XLocation-1)&"$Page_Split_page$"&mid(StrNewsContent,XLocation)
      iPageLen=0        '重新统计Html之外的字符
     End If
    End If
   ElseIf XLocation=0 then       '在后面再也找不到<,即后面没有Html标记了
    Exit Do
   ElseIf XLocation=DLocation+1 then    '找到的Html标记之间的内容为空,则继续向后找
    Inti=XLocation
   End If
  loop
 End If
AutoSplitPages=StrNewsContent
End Function
  • 上一篇文章:
  • 下一篇文章:
  • 关于我们 - 联系我们 - 广告服务 - 在线投稿 - 友情链接 - 网站地图 - 版权声明
    CopyRight 2008-2010, CWYDESIGN.COM - 畅无忧设计, Inc. All Rights Reserved
    滇ICP备09005765号