栏目导航
热点推荐
- ASP下批量删除数据的两种方法
- 关于二级域名共享cookies
- ASP错误代码大全
- ASP代码实现show.asp?id=26变成s
- ASP错误信息解决:IIS启用父路径
- 一些常用的正则表达式大全
- ASP超级链接和HTML函数正则表达
- ASP隐藏下载地址及防盗代码
- 最常用的正则表达式示例
- ASP程序数据库被挂马的处理方法
- ASP生成html的新方法
- 精通ASP错误提示大全
阅览排行
ASP实例教程:长文章分页功能
www.jz123.cn 2009-08-10 来源: 中国建站 责任编辑(袁袁) 我要投递新闻
要动态的还是静态的。先给你动态的吧。这个问题我弄了很久了,你好幸运有现成的给你,下面编写的函数
'按标识手动分页
function manualPage(str)
pages=request.QueryString("page")
contentstr=split(str,"{$page$}")
Response.Write(ContentStr(pages))
Response.Write("<p/>")
Response.Write("<div class=""pageList"">")
For i = 0 to ubound(ContentStr)
Response.Write("<a href='?ID="&id&"&page="&i&"'>"&i+1&"</a> ")
Next
Response.Write("</div>")
end function
'按长度分页
function autoPage(str,fontnum)
if len(str)>fontnum then
if len(str) mod fontnum>0 then '计算总页数
pagecontent=len(str)fontnum+1
else
pagecontent=len(str)fontnum
end if
Dim arr()
ReDim arr(pagecontent)
for m = 1 to pagecontent
if m<>pagecontent then
arr(m)= mid(str,(m*fontnum-fontnum+1),fontnum)
else
arr(m)= mid(str,(m*fontnum-fontnum+1),len(str))
end if
next
if Request.QueryString("page")<>"" then
Response.Write(arr(Request.QueryString("page")))
else
Response.Write(arr(1))
end if
Response.Write("<p/>")
Response.Write("<div class=""pageList"">")
for i = 1 to pagecontent
Response.Write("<a href=?ID="&id&"&page="&i&">"&i&"</a> ")
next
Response.Write("</div>")
else
Response.Write(str)
end if
end function
=============================
在页面中
<%
if Instr(Content,"{$page$}")=0 then '判断是否是手工分页标志,不是就自动分页
call autoPage(Content,2000)
else
call manualPage(Content)
end if
%>
上一篇:asp通过xmlhttp获取网页不完整 下一篇:ASP教程:读取文件和写文件