’按标识手动分页
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,(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在页面中:
<%
if instr(content,"{$page$}")=0 then ’判断是否是手工分页标志,不是就自动分页
call autopage(content,2000)
else
call manualpage(content)
end if
%>