01
<%
02
'==============================================
03
'函數名:ContentPage
04
'作 用:內容分頁
05
'參 數:1、oContent ----- 文章內容
06
' 2、oLink ----- 鏈接
07
'整 理:www.ASPprogram.cn
08
'原創文章,轉載請保留此信息,謝謝
09
'==============================================
10
11
Function
ContentPage(oContent, oLink)
12
Dim
outStr, arrContent, NextPage, arrPage
13
If
InStr(oContent,
"[NextPage]"
) <= 0
Then
14
outStr = oContent
15
Else
16
NextPage = Request(
"NextPage"
)
17
arrContent = Split(oContent,
"[NextPage]"
)
18
arrPage = UBound(arrContent) + 1
19
If
(NextPage =
""
Or
IsNull(NextPage)
Or
Not
IsNumeric(NextPage))
Then
20
NextPage = 1
21
Else
22
NextPage =
CInt
(NextPage)
23
End
If
24
If
NextPage < 1
Then
25
NextPage = 1
26
End
If
27
If
NextPage > arrPage
Then
28
NextPage = arrPage
29
End
If
30
outStr = arrContent(NextPage - 1)
31
outStr = outStr
"<br>"
32
For
iii = 1
To
arrPage
33
If
iii = NextPage
Then
34
outStr = outStr
"<font color="
"red"
">"
&iii
"</font> "
35
Else
36
outStr = outStr
"<a href="
""
&oLink
"NextPage="
&iii
""
">"
&iii
"</a> "
37
End
If
38
Next
39
End
If
40
ContentPage = outStr
41
End
Function
42
43
'=================Demo==================
44
Dim
sStrHtml, oStrHtml
45
sStrHtml =
"我的名字叫胡浪[NextPage]胡是古月的胡[NextPage]浪是三點水一個良字的浪[NextPage]不是一個帥哥哦[NextPage]很普通的一個人"
46
oStrHtml =
"我的名字叫胡浪,胡是古月的胡,浪是三點水一個良字的浪,不是一個帥哥哦,很普通的一個人"
47
'=================Demo==================
48
Response.Write(
"------------------- 帶分頁 ---------------------"
)
49
Response.Write(
"<br>"
)
50
Response.Write(ContentPage(sStrHtml,
"?"
))
51
Response.Write(
"<br>"
)
52
Response.Write(
"------------------- 不帶分頁 ---------------------"
)
53
Response.Write(
"<br>"
)
54
Response.Write(ContentPage(oStrHtml,
"?"
))
55
%>