文章内容手动分页代码
有些文章太长了,看起来特费劲,就想到了分页显示,网上找了些,也没有发现一个完整的,自己写了一个,反正效果是达到了,仅供参考!!!
在需要分页的地方,只用加上{$page}就可以了!
程序代码
id=request("id")
if id="" or IsNumeric(id)<>true then
response.write"请输入正确的ID号!"
response.end
end if
If Request("page")="" or isnumeric(Request("page"))=False or Request("page")="0" Then
pageNum=0
Else
pageNum=Request("page")-1
End if
set rs=server.createobject("adodb.recordset")
sql="select * from news where id="&id&""
rs.open sql,conn,1,1
if rs.eof then
response.write "此内容不存在"
response.end
else
news=rs("news")
end if
rs.close
ContentStr=split(news,"{$page}")
if pageNum>ubound(ContentStr) then pageNum=ubound(ContentStr)
if pageNum<0 then pageNum=0
response.write ContentStr(pageNum)
response.write "<br>本文共"
For p = 0 to ubound(ContentStr)
if pageNum=p then
response.write "<font color=red><b>"
response.write p+1
response.write "</b></font>"
else
response.write "<a href=new_view.asp?id="&ID&"&page="&p+1&">"
response.write p+1
response.write "</a>"
end if
Next
response.write "页"
参考网址:http://www.hengannet.com/new_view.asp?id=1006&page=1
在需要分页的地方,只用加上{$page}就可以了!

id=request("id")
if id="" or IsNumeric(id)<>true then
response.write"请输入正确的ID号!"
response.end
end if
If Request("page")="" or isnumeric(Request("page"))=False or Request("page")="0" Then
pageNum=0
Else
pageNum=Request("page")-1
End if
set rs=server.createobject("adodb.recordset")
sql="select * from news where id="&id&""
rs.open sql,conn,1,1
if rs.eof then
response.write "此内容不存在"
response.end
else
news=rs("news")
end if
rs.close
ContentStr=split(news,"{$page}")
if pageNum>ubound(ContentStr) then pageNum=ubound(ContentStr)
if pageNum<0 then pageNum=0
response.write ContentStr(pageNum)
response.write "<br>本文共"
For p = 0 to ubound(ContentStr)
if pageNum=p then
response.write "<font color=red><b>"
response.write p+1
response.write "</b></font>"
else
response.write "<a href=new_view.asp?id="&ID&"&page="&p+1&">"
response.write p+1
response.write "</a>"
end if
Next
response.write "页"
参考网址:http://www.hengannet.com/new_view.asp?id=1006&page=1