通知:本站部分产品已经可以在线直接下载,您可以在线充值下载即可,有问题到金币会员区提交即可,程序完整无错!不再受盗版之苦! 关闭
我们提供网站订制、修改服务,按您要求制作各类网站,价格低,速度快,用很少的钱轻松为您完成您的网站! 0539-2890890 54083049
本站首页新网空间快网商城成功案例正版认证购买指南升级下载网站套餐制作报价技术论坛
会员影音技术资讯订制进度服务流程一元源码十元源码百元源码8.0插件金币下载在线充值
  首 页 > 新闻列表 > 技术文摘 用户登陆 我要注册 忘记密码?  
新闻内容
实例:ASP实现长文章自动分页的函数代码
【 来源:网上摘录 】 【 发布时间:2008-06-22 】 【 字体:

Function c2u(myText)
  Dim i
  c2u = ""
  For i = 1 to Len(myText)
  c2u = c2u & "&#x" & Hex(AscW(Mid(myText, i, 1))) & ";"
  Next
  End Function

  Function cutStr(str,strlen)
  '去掉所有Html标记
  Dim re
  Set re=new RegEXP
  re.IgnoreCase =True
  re.Global=True
  re.Pattern="<(.[^>]*)>"
  str=re.Replace(str,"")
  set re=Nothing
  Dim l,t,c,i
  l=Len(str)
  t=0
  For i=1 to l
  c=Abs(Asc(Mid(str,i,1)))
  If c>255 Then
  t=t+2
  Else
  t=t+1
  End If
  If t>=strlen Then
  cutStr=left(str,i)&"..."
  Exit For
  Else
  cutStr=str
  End If
  Next
  cutStr=Replace(cutStr,chr(10),"")
  cutStr=Replace(cutStr,chr(13),"")
  End Function


  Function converttowide(str)
  Dim strlen
  Dim position
  Dim convertstr
  if isnull(str) then
  converttowide=str
  else
  position=1
  strlen=Len(str)
  For i=1 To strlen
  convertstr=convertstr+"&#x"+Hex(AscW(Mid(str,position,1)))+";"
  position=position+1
  Next
  converttowide=convertstr
  end if
  End Function

 


  dim topicx,usernamex,addtimex,logtextx,ispassWord
  '获取ID号
  articleid=request("articleid")
  '写执行语句
  strSQL = "select * from article where articleid="&articleid&""
  '接上面函数
  logtextx=cutStr(rs("content"),5000)
  '开始分页
  dim page,PageLength,CLength,PageCount,wen,a
  if Request("Page")<>"" then Page = CLng(Request("Page"))
  PageLength = 80
  CLength = Len(logtextx)
  PageCount = Int(Clength/PageLength) + 1
  if Page < 1 or IsNull(Page) Then Page = 1
  if Page > PageCount Then Page = PageCount
  if page=1 then
  a=1
  elseif page>1 then
  a=(Page-1)*PageLength
  end if
  wen=Mid(logtextx,a,PageLength)
  '判断
  if page="" or page=1 then
  '开始显示内容
  Response.write (c2u("内容:"))'www.kuaiwww.com
  end if
  Response.write (converttowide(wen))
Response.write "<br/>"
  'Response.write (converttowide("本文字数:")) & CLength

1 [2]  下一页

添加时间:2008-06-22  浏览次数:3574

免责声明
您现在的位置:管理首页 >> 免责声明
① 快网科技版权所有,尊重劳动,支持正版,享受服务;
②个别文章资讯摘自网络,如有侵权,请联系我们删除;
③对于版权作者未联系我们声明的作品,视同作者许可快网刊登。
新闻分类
新闻搜索
  关键字:
主题 内容 
热门新闻
| 联系我们 | 公司简介 | 反盗声明 | 责任合约 | 品质保证 | 快网优势 | 管理团队 | 公司招聘 | 经营理念 | 荣誉资质 | 汇款方式
公司地址:山东·临沂·兰山 邮政编码:276000 Email:lyoy2008@163.com
联系电话:0539-2890890 13581084088 传真号码:0539-2890890
快网科技法律顾问: [山东君正义律师事务所] 王自道  [山东铭星律师事务所] 王纪营
版权所有.2007-2010.快网科技网络公司 中国信息产业部备案 鲁ICP备09104898号