📄 comcls.asp
字号:
<%
'公共函數,過程類
Dim RowCount
Class FunctionClass
Function MessageToUrl(n)'傳輸信息
If n="" Then
Response.Write "<script language=javascript>alert('提示:MessageToUrl參數為空!');</script>"
Response.End
Else
Response.Write"<a href='"&n&"'><span>返回</span></a>"
End If
End Function
'=============================================================
Public Sub GoToUrl(Url)'網頁跳轉
Response.Redirect(Url)
End Sub
'=============================================================
Public Sub JavaScriptGoToUrl(Url)'客戶端網頁跳轉
Response.write "<script language=javascript>window.location='"&Url&"';</script>"
End Sub
'=============================================================
'=============================================================
Sub ErrMessage(StrErr)'捕捉後台代碼出錯
If Trim(StrErr)="" Then
Response.Write "<script language=javascript>alert('提示:ErrMessage參數為空!');</script>"
Response.End
Else
Response.Write "<script language=javascript>alert('"&StrErr&"');</script>"
Response.End
End If
End Sub
'=============================================================
Public Sub MessAgeShowDialog(StrVal)'提示信息返回原來的網頁
Response.Write"<script lanuage=Javascript>alert('"&StrVal&"');history.go(-1);</script>"
Response.end
End Sub
'=============================================================
Public Sub ShowMessAge(StrVal)'提示
Response.Write"<script lanuage=Javascript>alert('"&StrVal&"');</script>"
End Sub
'==================================================================
function Showpage()'
Showpagebody= "<table width=100% ><tr><td>"
Showpagebody=Showpagebody& "共<font color=#FF0000>"&AdoRs.recordcount&"</font>条记录"
Showpagebody=Showpagebody&" "
Showpagebody=Showpagebody&"分<font color=#FF0000>"&AdoRs.pagecount&"</font>页"
Showpagebody=Showpagebody&" "
Showpagebody=Showpagebody&"每页<font color=#FF0000>"&AdoRs.pagesize&"</font>条 "
Showpagebody=Showpagebody&" 当前是第<font color=#FF0000>"&page&"</font>页"
Showpagebody=Showpagebody&"</td><td align=right>"
If page=1 then
Showpagebody=Showpagebody&"首页 | 上一页"
Else
Showpagebody=Showpagebody&"<a href='Javascript:GoPage(1);'>首页</a> | <a href='Javascript:GoPage("&Page-1&");'>上一页</a>"
End If
Showpagebody=Showpagebody&" | "
If Cint(page)=Cint(AdoRs.pagecount) Then
Showpagebody=Showpagebody&"下一页 | 尾页"
Else
Showpagebody=Showpagebody&"<a href='Javascript:GoPage("&Page+1&");'>下一页</a> | <a href='Javascript:GoPage("&AdoRs.Pagecount&");'>尾页</a>"
End If
Showpagebody=Showpagebody&" "
Showpagebody=Showpagebody&"</td></tr></table>"
Showpage=Showpagebody
End function
Public sub divpage(recordno,pagereq)
AdoRs.pagesize=recordno
page=1
if pagereq="" then
pagereq=""
end if
if pagereq<>"" then
page=pagereq
if Cint(pagereq)<1 then page=1
if Cint(pagereq)>Cint(AdoRs.pagecount) then page=AdoRs.pagecount
end if
AdoRs.absolutepage=page
rowcount=AdoRs.pagesize
end sub
'=============================================================
Public Sub SetAdoCn(Obj,AdoSQL)
Set Obj=Server.CreateObject("AdoDb.ConNection")
Obj.Open AdoSQL
End Sub
Public Sub SetAdoRs(Obj)
Set Obj=Server.CreateObject("Adodb.RecordSet")
End Sub
Public Sub AdoRsClose(Obj)
If Obj.State=1 Then
Obj.Close
End If
End Sub
Public Sub AdoRsNothing(Obj)
If Not Obj Is Nothing Then
Set Obj=Nothing
End If
End Sub
Public Sub AdoCnNothing(Obj)
If Obj.State=1 Then
Obj.Close
End If
If Not Obj Is Nothing Then
Set Obj=Nothing
End If
End Sub
'-----------------------------------------------------------------
Public function sift_javascript(Content)'过滤javascrpt
Set regEx = New RegExp ' 建立正则表达式。
regEx.Pattern ="<script.*</script>" ' 设置模式。
regEx.IgnoreCase = True ' 设置是否区分大小写。
sift_javascript = regEx.Replace(Content, "")
End function
'----------------------------------------------------------------
public function sift_html(Content) '过滤html
Set regEx = New RegExp ' 建立正则表达式。
'regEx.Pattern ="/<(.*)>.*<\/\1>|<(.*) \/>/" ' 设置模式。
regEx.Pattern ="(<[a-zA-Z].*?>)|(<[\/][a-zA-Z].*?>)"
regEx.IgnoreCase = True ' 设置是否区分大小写。
sift_html = regEx.Replace(Content,"")
end function
'---------------------------------------------------------------
Public Function Sift_Str(StrVal,mType)'1数值2-字符串
Dim Str
If mTYpe=1 Then
If Not IsNumeric(StrVal) Then
Sift_Str=0
Else
Sift_str=StrVal
End If
Else
Dim TempAry
Str=" or ,',delete ,update , where ,select ,inser , declare , - , @,$"
TempAry=Split(Str,",")
Sift_Str=StrVal
For i=0 To Ubound(TempAry)
Sift_str=Trim(Replace(Sift_Str,TempAry(i),""))
Next
End If
End Function
'-------------------------------------------------------------
public function InterceptString(Str,StrNum) 'str 需截取的字符串,StrNum截取多少个字符串
if len(str)>strnum then
interceptstring=mid(str,1,strnum)
else
interceptstring=str
end if
end function
'----------------------------------------------------------
public function Sift_href(strVal)
Set re=new RegExp
re.IgnoreCase =True
re.Global=True
re.Pattern="\<a (.*)\>(.*)</a>"
Sift_href=re.Replace(strVal,"")'去掉超级链接
end function
'=============================================================
End Class
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -