ASP内容分页函数
ASP #分页 #函数2012-04-27 17:29
<%
'==============================================
'函数名:contentpage
'作 用:内容分页
'参 数:1、ocontent ----- 文章内容
' 2、olink ----- 链接
'==============================================
function contentpage(ocontent, olink)
dim outstr, arrcontent, nextpage, arrpage
if instr(ocontent, "[nextpage]") <= 0 then
outstr = ocontent
else
nextpage = request("nextpage")
arrcontent = split(ocontent, "[nextpage]")
arrpage = ubound(arrcontent) + 1
if (nextpage = "" or isnull(nextpage) or not isnumeric(nextpage)) then
nextpage = 1
else
nextpage = cint(nextpage)
end if
if nextpage < 1 then
nextpage = 1
end if
if nextpage > arrpage then
nextpage = arrpage
end if
outstr = arrcontent(nextpage - 1)
outstr = outstr "<br>"
for iii = 1 to arrpage
if iii = nextpage then
outstr = outstr "<font color=""red"">"&iii"</font> "
else
outstr = outstr "<a href="""&olink"nextpage="&iii""">"&iii"</a> "
end if
next
end if
contentpage = outstr
end function
'=================demo==================
dim sstrhtml, ostrhtml
sstrhtml = "我的名字叫胡浪[nextpage]胡是古月的胡[nextpage]浪是三点水一个良字的浪[nextpage]不是一个帅哥哦[nextpage]很普通的一个人"
ostrhtml = "我的名字叫胡浪,胡是古月的胡,浪是三点水一个良字的浪,不是一个帅哥哦,很普通的一个人"
'=================demo==================
response.write("------------------- 带分页 ---------------------")
response.write("<br>")
response.write(contentpage(sstrhtml, "?"))
response.write("<br>")
response.write("------------------- 不带分页 ---------------------")
response.write("<br>")
response.write(contentpage(ostrhtml, "?"))
%>相关文章
- asp无组件文件上传类 2012/04/27
- 防止ASP木马 2012/04/27
- asp操作Excel的类 2012/04/27
- asp防sql注入函数 2012/04/27
- ASP判断dll文件是否已注册的函数 2012/04/27
- asp连接access数据库代码 2012/04/27
- asp中uft8和gb2312转换乱码解决方法 2012/04/27
- ASP组件Adodb.Stream用法介绍 2012/04/27
- 掌握ASP只需6步 2012/04/27
- ASP建立站内搜索 2012/04/27