ASP内容分页函数
作者:袖梨
2022-06-29
- <%
-
-
-
-
-
-
-
-
-
- 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 "
"
- for iii = 1 to arrpage
- if iii = nextpage then
- outstr = outstr ""red"">"&iii" "
- else
- outstr = outstr """&olink"nextpage="&iii""">"&iii" "
- end if
- next
- end if
- contentpage = outstr
- end function
-
-
- dim sstrhtml, ostrhtml
- sstrhtml = "我的名字叫胡浪[nextpage]胡是古月的胡[nextpage]浪是三点水一个良字的浪[nextpage]不是一个帅哥哦[nextpage]很普通的一个人"
- ostrhtml = "我的名字叫胡浪,胡是古月的胡,浪是三点水一个良字的浪,不是一个帅哥哦,很普通的一个人"
-
- response.write("------------------- 带分页 ---------------------")
- response.write("
")
- response.write(contentpage(sstrhtml, "?"))
- response.write("
")
- response.write("------------------- 不带分页 ---------------------")
- response.write("
")
- response.write(contentpage(ostrhtml, "?"))
- %>