当前位置:K88软件开发文章中心编程语言AspAsp01 → 文章内容

ASP内容分页函数

减小字体 增大字体 作者:佚名     来源:asp编程网  发布时间:2018-12-30 8:33:10

<
%'=============================================='函数名:ContentPage'作 用:内容分页'参 数:1、oContent ----- 文章内容' 2、oLink ----- 链接'整 理:www.aspprogram.cn''==============================================Function ContentPage(oContent, oLink) Dim outStr, arrContent, NextPage, arrPage If InStr(oContent, "") <
= 0 Then outStr = oContent Else NextPage = Request("NextPage") arrContent = Split(oContent, "") 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 = outStrEnd Function'=================Demo==================Dim sStrHtml, oStrHtmlsStrHtml = "我的名字叫胡浪胡是古月的胡浪是三点水一个良字的浪不是一个帅哥哦很普通的一个人"oStrHtml = "我的名字叫胡浪,胡是古月的胡,浪是三点水一个良字的浪,不是一个帅哥哦,很普通的一个人"'=================Demo==================Response.Write("------------------- 带分页 ---------------------")Response.Write("<
br>
")Response.Write(ContentPage(sStrHtml, "?"))Response.Write("<
br>
")Response.Write("------------------- 不带分页 ---------------------")Response.Write("<
br>
")Response.Write(ContentPage(oStrHtml, "?"))%>
(鼠标移到代码上去,在代码的顶部会出现四个图标,第一个是查看源代码,第二个是复制代码,第三个是打印代码,第四个是帮助)


ASP内容分页函数