複製代碼 代碼如下:<%
'/* 函數名稱:Zxj_ReplaceHtml ClearHtml
'/* 函數語言:VBScript Language
'/* 作 用:清除檔案HTML格式函數
'/* 傳遞參數:Content (註:需要進行清除的內容)
'/* 函數作者:張曉軍(古城童話) QQ:382511147
'/* 函數說明:正則匹配(Regex)模式進行資料匹配替換
Function ClearHtml(Content)
Content=Zxj_ReplaceHtml("[^>]*;", "", Content)
Content=Zxj_ReplaceHtml("</?marquee[^>]*>", "", Content)
Content=Zxj_ReplaceHtml("</?object[^>]*>", "", Content)
Content=Zxj_ReplaceHtml("</?param[^>]*>", "", Content)
Content=Zxj_ReplaceHtml("</?embed[^>]*>", "", Content)
Content=Zxj_ReplaceHtml("</?table[^>]*>", "", Content)
Content=Zxj_ReplaceHtml(" ","",Content)
Content=Zxj_ReplaceHtml("</?tr[^>]*>", "", Content)
Content=Zxj_ReplaceHtml("</?th[^>]*>","",Content)
Content=Zxj_ReplaceHtml("</?p[^>]*>","",Content)
Content=Zxj_ReplaceHtml("</?a[^>]*>","",Content)
Content=Zxj_ReplaceHtml("</?img[^>]*>","",Content)
Content=Zxj_ReplaceHtml("</?tbody[^>]*>","",Content)
Content=Zxj_ReplaceHtml("</?li[^>]*>","",Content)
Content=Zxj_ReplaceHtml("</?span[^>]*>","",Content)
Content=Zxj_ReplaceHtml("</?div[^>]*>","",Content)
Content=Zxj_ReplaceHtml("</?th[^>]*>", "", Content)
Content=Zxj_ReplaceHtml("</?td[^>]*>", "", Content)
Content=Zxj_ReplaceHtml("</?script[^>]*>", "", Content)
Content=Zxj_ReplaceHtml("(javascript|jscript|vbscript|vbs):", "", Content)
Content=Zxj_ReplaceHtml("on(mouse|exit|error|click|key)", "", Content)
Content=Zxj_ReplaceHtml("<\\?xml[^>]*>", "", Content)
Content=Zxj_ReplaceHtml("<\/?[a-z]+:[^>]*>", "", Content)
Content=Zxj_ReplaceHtml("</?font[^>]*>", "", Content)
Content=Zxj_ReplaceHtml("</?b[^>]*>","",Content)
Content=Zxj_ReplaceHtml("</?u[^>]*>","",Content)
Content=Zxj_ReplaceHtml("</?i[^>]*>","",Content)
Content=Zxj_ReplaceHtml("</?strong[^>]*>","",Content)
ClearHtml=Content
End Function
Function Zxj_ReplaceHtml(patrn, strng,content)
IF IsNull(content) Then
content=""
End IF
Set regEx = New RegExp ' 建立Regex。
regEx.Pattern = patrn ' 設定模式。
regEx.IgnoreCase = true ' 設定忽略字元大小寫。
regEx.Global = True ' 設定全域可用性。
Zxj_ReplaceHtml=regEx.Replace(content,strng) ' 執行正則匹配
End Function
%>