您尚未登录,请登录后浏览更多内容! 登录 | 立即注册

QQ登录

只需一步,快速开始

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 356|回复: 0

asp实现文章内容过长 自动分页

[复制链接]

3

主题

0

听众

17

积分

应届毕业生

Rank: 1

性别
保密
听众数
0
买家信用
卖家信用
在线时间
15 小时
相册
0
发表于 2011-10-7 16:47:00 |显示全部楼层
程序员装备

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
  <TITLE> New Document </TITLE>
</HEAD>
<%
function manualPage(str)
pages=request.QueryString("page")
contentstr=split(str,"{$page$}")
Response.Write(ContentStr(pages))
Response.Write("<p/>")
Response.Write("<div class=""pageList"">")
For i = 0 to ubound(ContentStr)
Response.Write("<a href=’?ID="&id&"&page="&i&"’>"&i+1&"</a> ")
Next
Response.Write("</div>")
end Function

function autoPage(str,fontnum)
if len(str) > 20 Then
if len(str) Mod 20 >0 then
pagecontent=len(str)\fontnum+1
else
pagecontent=len(str)\fontnum
end if
Dim arr()
ReDim arr(pagecontent)
for m = 1 to pagecontent
if m<>pagecontent then
arr(m)= mid(str,(m*fontnum-fontnum+1),fontnum)
else
arr(m)= mid(str,(m*fontnum-fontnum+1),len(str))
end if
next
if Request.QueryString("page")<>"" then
Response.Write(arr(Request.QueryString("page")))
else
Response.Write(arr(1))
end if
Response.Write("<p/>")
Response.Write("<div class=""pageList"">")
for i = 1 to pagecontent
Response.Write("<a href=?ID="&id&"&page="&i&">"&i&"</a> ")
next
Response.Write("</div>")
else
Response.Write(str)
end if
end function
%>
<BODY>
<%
Content ="sfsdasdfffffffffffffffffffffffffffffffffffffffffffgdsagadsgagfdgffgfgggggggggggggggggggggghhhhhhhhhhhhhhhhhhhhhhkkkkkkkkkkkkkkkkkkkkkkkkkkkkkklllllllllllllllllllllll"
  if Instr(Content,"{$page$}")=0 then
  call autoPage(Content,20)
  else
  call manualPage(Content)
  end if
  %>
</BODY>
</HTML>
您需要登录后才可以回帖 登录 | 立即注册


关闭

站长推荐上一条 /1 下一条



      
    Archiver|手机版|臣迅电子商务|网站地图|渝ICP备11003388号

GMT+8, 2012-5-20 09:33

© 2001-2011 Powered by Discuz! X2.5. Theme By Yeei! update By CNNTEC

webSite begin 2005

回顶部