日期:2014-05-16 浏览次数:20843 次
AC_Str = "123456789[换页]123456789" '文章的内容
number = 1200 '自动分页字数
View_number = Len(AC_Str) '计算文章总字数
l_c_n = Split(AC_Str,"[换页]") '计算换页符号数量
a_l_c_n = Ubound(l_c_n) + 1 '全文[换页]总数
If View_number mod number = 0 Then '如果没有分页
Pagecount = fix(View_number/number)
ElseIf InStr(ArticleStr,"{$换行$}") > 0 Then '如果有换页符号,分页总数
Pagecount = fix(View_number/number) '这里不会写……
Else '自动分页字数,分页总数
Pagecount = fix(View_number/number) + 1
End If
i = (Page-1) * number + 1
j = number
Response.write mid(AC_Str,i,j)&"<br />" '这里不知是否需要修改
totalpage=0
currentpage=1'当前页,测试用,实际通过request.querystrign获取
pagenumber=8'按字数分页,每页显示多少个字数
function getStr(s)
pagebynumber=false'是否按照字数分页
arr=split(s,"[换页]")
totalpage=ubound(arr)+1
if totalpage=1 then'为1说明没有“[换页]”手动分页,按照字符计算总页数
pagebynumber=true
totalchar=len(s)
if totalchar mod pagenumber =0 then
totalpage=totalchar \ pagenumber
else
totalpage=totalchar \ pagenumber +1
end if
end if
if currentpage<1 then currentpage=1
if currentpage>totalpage then currentpage=totalpage
if pagebynumber then'按字数分页
if totalpage=1 then'不足字数
getStr=s
else
getStr=mid(s,(currentpage-1)*pagenumber+1,pagenumber)
end if
else
getStr=arr(currentpage-1)'通过关键字
end if
end function
s = "123456789abcdefghijklmn" '按字数分
currentpage=1
response.write getStr(s)&"<br/>"
currentpage=2
response.write getStr(s)&"<br/>"
currentpage=3
response.write getStr(s)&"<br/>"
'''''''''''''''''''''''''''''''''''''''''''''
s = "1234567[换页]89ab[换页]cdefg[换页]hij[换页]klmn" '按[换页]
currentpage=1
response.write getStr(s)&"<br/>"
currentpage=2
response.write getStr(s)&"<br/>"
currentpage=3
response.write getStr(s)&"<br/>"