ASP实现长文章内容自动分页或手动分页函数asp

/ / 2025-03-29   阅读:2560
ASP实现长文章内容自动分页或手动分页函数...

如果一篇文章太长我们可以给其分页,现在各大门户新闻基本上都做了分页,长文章内容分页2个实现思路:自动安字数分页或手动标示分页。下面请看青岛星网的长文章分页思路代码函数。


ASP实现长文章内容自动分页或手动分页函数

'长文章内容按标识手动分页
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>&nbsp;")
Next
Response.Write("</div>")
end function

'长文章内容按长度分页
function autoPage(str,fontnum)
if len(str)>fontnum then
if len(str) mod fontnum>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


我要评论

昵称:
验证码:

最新评论

共0条 共0页 10条/页 首页 上一页 下一页 尾页
意见反馈