<%
Function listbody(body)
dim arrbody,pages
if Instr(body,"分隔符")<=0 then
response.write body
'response.write "</p><p align='center'><font color='red'><b>[1]</b></font></p>"
else
CurPage=request("CurPage")
arrbody=split(body,"分隔符")
pages=Ubound(arrbody)+1
if CurPage="" then
CurPage=1
else
CurPage=Cint(CurPage)
end if
if CurPage<1 then CurPage=1
if CurPage>pages then CurPage=pages
response.write arrbody(CurPage-1)
response.write "<div align=center>"
for i=1 to pages
if CurPage>1 then
response.write "『<a href=?news_id="&request("news_id")&"&CurPage="&CurPage-1&">上一页</a>
』"
else
response.write "<font color='#cccccc'>『上一页』</font>"
end if
if i=Curpage then
response.write "[<font color=red>"&i&"</font>] "
else
response.write "[<a href=?news_id="&request("news_id")&"&CurPage="&i&">"&i&"</a>] "
end if
if CurPage<pages then
response.write "『<a href=?news_id="&request("news_id")&"&CurPage="&CurPage+1&">下一页</a>
』"
else
response.write "<font color='#cccccc'>『下一页』</font>"
end if
next
response.write "</div>"
end if
End Function
%>
调用listbody函数显示文章内容:<%=listbody(rs("content"))%>
原理:
在参数body即rs("content")里加上分隔符,用instr进行判断,如果有分隔符,用split函数把body进行
分隔,定义为数组,根据数组索引值进行分页.