Only now found that the ASP can also write some of their own classes, and basically similar to other languages, so they wrote a try, hey! The Annals!
<%
Class CLSDSJ
Private P_error,p_author,p_weburl
Public Property Get Version
version= "DSJ 1.0.0 Beta"
End Property
Public Property Get Error
Error=p_error
End Property
Public Property Get Author
Author=p_author
End Property
Public Property Let Author (Strauthor)
Strauthor=trim (Strauthor)
If strauthor= "" Then
P_author= "Lone Sword"
Else
P_author=cstr (Strauthor)
End If
End Property
Public Property Get Weburl
Weburl=p_weburl
End Property
Public Property Let Weburl (URL)
Url=trim (URL)
If url= "" Then
P_weburl= "http://www.blog.csdn.net/alonesword/"
ELse
If LCase (CStr (left (url,7)) <> "http://" then
P_weburl= "http://" & URL
Else
P_weburl=url
End If
End If
End Property
Private Sub Class_Initialize
P_author= "Lone Sword"
Weburl= "http://www.blog.csdn.net/alonesword/"
P_error=-1
End Sub
Private Sub Class_Terminate
End Sub
Public Function gottopic (Str,strlen)
Rem Limit string display length within a certain range
Dim I,stringlen,charsize,echochartype
Stringlen=len (str)
Charsize=0
For I=1 to Stringlen
Echochartype=abs (ASC (str,i,1))
If echochartype>255 Then
Charsize=charsize+2
Else
Charsize=charsize+1
End If
If Charsize>strlen Then
Gottopic=left (str,i) & "..."
Exit for
Else
Gottopic=str & ""
End If
Next
End Function
'******************************
' Name: chkinvaildwords
' Parameter: Words
' Return value: True/falsh
' Function: Check if the parameter has illegal characters
'******************************
Function Chkwords (Words)
Rem definition needs to filter illegal characters
Const invaildwords= "select|update|delete|insert|@|--|,| ' | #|%"
Chkwords=true
Invaildword=split (invaildwords, "|")
Inwords=lcase (Trim (Words))
For I=lbound (Invaildword) to UBound (Invaildword)
If Instr (Inwords,invaildword (i)) >0 Then
P_error=0
Chkwords=false
Exit Function
End If
Next
Chkwords=true
End Function
Function Dividedpage (Objrs,perpagesize,currentpage)
Objrs.pagesize=perpagesize
Totalpage=objrs.pagecount
If IsEmpty (perpagesize) Or IsEmpty (currentpage) Then
P_error=1
Response.Write ("<font style= ' font-size:12px;") > parameter cannot be empty! <br></Font> ")
Response.End ()
Exit Function
ElseIf (IsNumeric (perpagesize) =false Or isnumeric (currentpage) =false) Then
p_error=2
Response.Write ("<font style= ' font-size:12px;") > parameter cannot be empty! <br></Font> ")
Response.End ()
Exit Function
End If
If CLng (currentpage) <1 Then currentpage=1 End If
If CLng (currentpage) >totalpage Then currentpage=totalpage End If
If totalpage>0 Then
Objrs.absolutepage=currentpage
End If
Items=1
Do as Not objrs.eof
Response.Write (Items)
Objrs.movenext
Loop
End Function ' terminated on November 27, 2004
End Class
Dim DSJ
Set dsj=new CLSDSJ
%>