日期:2014-05-17  浏览次数:20854 次

文章内容自动分页
在asp中

有的文章内容过长,我想把内容分页,怎么实现啊

------解决方案--------------------
思路可以有两种:
1.插入分割符,再根据它来分页
2.每页大概需要多少个字,进行分页
------解决方案--------------------
读取文章数据
判断当前页码
用LEN()分割
------解决方案--------------------
Up

------解决方案--------------------
' ' ' ' ' '最简单的长文单分页
' ' ' ' ' 'Power by Love_Computer
' ' ' ' ' ' http://www.56390.com/
' ' ' ' ' 'love_computer@163.com
' ' ' ' ' '2005-9-22
TestStr = "111111111,2222222222222,333333333333,444,555555555,6666666666,777777777,888888,99999999,00000000000000 "
PageLen = 20 '每页显示长度
SplitStr = ", " '分隔关键字符串
If Len(TestStr) <= PageLen Then
Response.Write TestStr & " <br/> "
Else
str = Split(TestStr,SplitStr)
strShow = " "
Page = Trim(Request.QueryString( "page "))
If Page = " " Then page = 1
x = Trim(Request.QueryString( "x "))
If x = " " Then
x = 0
Else
x = x + 1
End If
For i = x To ubound(str)-1
strShow = strShow & str(i) & SplitStr
If Len(strShow) > PageLen Then
x = i
Exit For
End If
Next
' ' ' ' ' 'Power by Love_Computer
' ' ' ' ' 'love_computer@163.com
' ' ' ' ' '2005-9-22
Response.Write strShow & " <br/> "
If Page > 1 Then
Response.Write " <a href= 'javascript:history.back(); '> [上页] </a> "
Else
Response.Write " [上页] "
End If
If x < ubound(str)-1 Then
Response.Write " <a href= '?x= " & x & "&page= " & Page + 1 & " '> [下页] </a> "
Else
Response.Write " [下页] "
End If
End If