|
<%
dim articleStr,CurrentPage,Maxlen,totalLen,i,j,n
articleStr="一面在政策的大树下乘凉,一面又想拿丰厚的回报,把天下好事都沾光,还得别人闭嘴,不说闲话,这是怎样一种逻辑?更何况,真要对电力职工收入做出公正合理的鉴定,也没电监会什么事,哪有左手为右手辩护的,害臊不害臊?." 'articleStr为文章内容。
'以下就是对articleStr进行分页
Maxlen=10
totalLen=len(articleStr)
if totalLen mod Maxlen = 0 then
pageCounts=fix(totalLen/Maxlen)
else
pageCounts=fix(totalLen/Maxlen)+1
end if
Response.write "总页数:"&pageCounts&"<br>"
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)&"<br>"
if CurrentPage<2 then
Response.write "首页 上一页"
else
Response.write "<a href='?page=1'>首页</a> <a href='?page="&Cint(CurrentPage)-1&"'>上一页</a>"
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"<a href='?page="&n&"'>["&n&"]</a> "
end if
next
if CurrentPage+3<pageCounts then Response.write"..."
if Clng(CuttentPage)=pageCounts then
Response.write "下一页 末页"
else
Response.write "<a href='?page="&Cint(CurrentPage)+1&"'>下一页</a> <a href='?page="&Cint(pageCounts)&"'>末页</a>"
end if
%>
引用地址:http://zhidao.baidu.com/question/22855654.html |
|