<%
dim articleStr,CurrentPage,Maxlen,totalLen,i,j,n
articleStr = rs("content") '从数据库中读取的内容
Maxlen = 1000 '初始化每页显示的字数
totalLen = len(articleStr)
if totalLen mod Maxlen = 0 then
pageCounts = fix(totalLen/Maxlen)
else
pageCounts = fix(totalLen/Maxlen)+1
end if
CurrentPage = Request("page")
if CurrentPage = "" then
CurrentPage = 1
end if
if Clng(CurrentPage) > pageCounts then CurrentPage = pageCounts
i = (CurrentPage-1)*Maxlen+1
j = Maxlen
Response.write mid(articleStr,i,j)&"
" '内容显示

'分页代码开始
Response.write "总页数:"&pageCounts&" "
if CurrentPage < 2 then
Response.write "首页 上一页"
else
Response.write "首页 上一页"
end if
if CurrentPage > 3 then Response.write"..."
for n = CurrentPage - 3 to CurrentPage + 3
if n > 0 and Clng(n) <= pageCounts then
Response.write"["&n&"] "
end if
next
if CurrentPage + 3 < pageCounts then Response.write"..."
if Clng(CuttentPage) = pageCounts then
Response.write "下一页 末页"
else
Response.write "下一页 末页"
end if
%>