piaoling
2009/10/28 13:43:00
sub arti_page(str)
str=replace(str,"<br>","<BR>")
str=replace(str,"<p>","<P>")
const pageline=10 '每页显示10段
linenum=split(str,"<P>") '本例为计算字符串<br>标记的个数
allline=ubound(linenum)+1 '全文<br>(换行标记)总数
pagecount=int(allline\pageline)+1 '计算总页数
if allline mod pageline =0 then pagecount=allline/pageline
page=request("page")
if isempty(page) then
thispage=1
else
thispage=cint(page)
end if
'response.write "<title>"&title&"</title><b>"&title&"</b><hr>"
for i=0 to allline-1
if i+1>thispage*pageline-pageline and i<thispage*pageline then
response.write linenum(i) &"<br>" '输出分页后的内容
end if
next
response.write chr(13)&"<hr>"
response.write "<p align='center'>总共"&allline&"行 "&pagecount&"页 每页"&pageline&"行 "
for i=1 to pagecount
if thispage=i then
response.write i & " "
else
response.write "<a href='?page="&i&"&id="&id&"'>"&i&"</a> " '输出所有分页链接
end if
next
end sub