The following is a reference clip:
Function c2u (mytext)
Dim I
C2u = ""
For I = 1 to Len (mytext)
C2u = c2u & "" & hex (ASCW (mid (mytext, I, 1 )))&";"
Next
End Function
The following is a reference clip:
function cutstr (STR, strlen)
'remove all HTML tags
dim Re
set Re = new Regexp
re. ignorecase = true
re. global = true
re. pattern = "<(. [^>] *)> "
STR = Re. replace (STR, "")
set Re = nothing
dim L, T, C, I
L = Len (STR)
T = 0
for I = 1 to L
C = ABS (ASC (mid (STR, I, 1 )))
If C> 255 then
T = T + 2
else
T = t + 1
end if
If T> = strlen then
cutstr = left (STR, I )&"... "
exit for
else
cutstr = STR
end if
next
cutstr = Replace (cutstr, CHR (10 ), "")
cutstr = Replace (cutstr, CHR (13), "")
end function
The following is a reference clip:
Function converttowide (STR)
Dim strlen
Dim position
Dim convertstr
If isnull (STR) then
Converttowide = Str
Else
Position = 1
Strlen = Len (STR)
For I = 1 to strlen
Convertstr = convertstr + "" + hex (ASCW (mid (STR, position, 1) + ";"
Position = Position + 1
Next
Converttowide = convertstr
End if
End Function
The following is a reference clip:
Dim topicx, usernamex, addtimex, logtextx, ispassword
'Get ID number
ArticleID = request ("ArticleID ")
'Write execution statement
Strsql = "select * from article where ArticleID =" & ArticleID &""
'Interface Function
Logtextx = cutstr (RS ("content"), 5000)
'Start pagination
Dim page, pagelength, clength, pagecount, Wen,
If request ("page") <> "then page = clng (Request (" page "))
Pagelength = 80
Clength = Len (logtextx)
Pagecount = int (clength/pagelength) + 1
If page <1 or isnull (PAGE) Then page = 1
If page> pagecount then page = pagecount
If page = 1 then
A = 1
Elseif page> 1 then
A = (page-1) * pagelength
End if
Wen = mid (logtextx, A, pagelength)
'Judge
If page = "" or page = 1 then
'Start to show content
Response. Write (c2u ("content:") 'www .w3sky.com
End if
Response. Write (converttowide (Wen ))
Response. Write "<br/>"
'Response. Write (converttowide ("words:") & clength & "<br/>"
Response. write (c2u ("this article is divided into") & pagecount & (converttowide ("page") & "& c2u (" current "& page &" page ") & "<br/>"
If pagecount> 1 and page <> 1 then 'WWW .w3sky.com
Response. Write "1"
End if
Dim J
For J = page + 1 to page + 10
If j <= PageCount-1 then
Response. Write "" & J &""
End if
Next
If pagecount> 1 and page <> pagecount then
Response. Write "<a href ="/"showarticle. asp? ArticleID = "& ArticleID &" & page = "& pagecount &" ">" & pagecount & "</a> <br/>"
End if
'End