微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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> ")

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,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

=============================

页面

<% 

if Instr(Content,"{$page$}")=0 then '判断是否是手工分页标志,不是就自动分页

call autopage(Content,2000)

else

call manualPage(Content)

end if

%> 

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐