ĿʱҪȥݵһЩָHTMLǩȥdivǩȥAǩȥTableǩȵȣൺҷһװ
ASPȥHTMLǩ
<%
'/* ƣqdxw_ReplaceHtmlClearHtml
'/* ԣVBScript Language
'/* ãļHTMLʽ
'/* ݲContent (עҪ)
'/* ˵ƥ(ʽ)ģʽƥ滻
Function ClearHtml(Content)
Content=qdxw_ReplaceHtml("&#[^>]*;", "", Content)
Content=qdxw_ReplaceHtml("</?marquee[^>]*>", "", Content)
Content=qdxw_ReplaceHtml("</?object[^>]*>", "", Content)
Content=qdxw_ReplaceHtml("</?param[^>]*>", "", Content)
Content=qdxw_ReplaceHtml("</?embed[^>]*>", "", Content)
Content=qdxw_ReplaceHtml("</?table[^>]*>", "", Content)
Content=qdxw_ReplaceHtml(" ","",Content)
Content=qdxw_ReplaceHtml("</?tr[^>]*>", "", Content)
Content=qdxw_ReplaceHtml("</?th[^>]*>","",Content)
Content=qdxw_ReplaceHtml("</?p[^>]*>","",Content)
Content=qdxw_ReplaceHtml("</?a[^>]*>","",Content)
Content=qdxw_ReplaceHtml("</?img[^>]*>","",Content)
Content=qdxw_ReplaceHtml("</?tbody[^>]*>","",Content)
Content=qdxw_ReplaceHtml("</?li[^>]*>","",Content)
Content=qdxw_ReplaceHtml("</?span[^>]*>","",Content)
Content=qdxw_ReplaceHtml("</?div[^>]*>","",Content)
Content=qdxw_ReplaceHtml("</?th[^>]*>", "", Content)
Content=qdxw_ReplaceHtml("</?td[^>]*>", "", Content)
Content=qdxw_ReplaceHtml("</?script[^>]*>", "", Content)
Content=qdxw_ReplaceHtml("(javascript|jscript|vbscript|vbs):", "", Content)
Content=qdxw_ReplaceHtml("on(mouse|exit|error|click|key)", "", Content)
Content=qdxw_ReplaceHtml("<//?xml[^>]*>", "", Content)
Content=qdxw_ReplaceHtml("<//?[a-z]+:[^>]*>", "", Content)
Content=qdxw_ReplaceHtml("</?font[^>]*>", "", Content)
Content=qdxw_ReplaceHtml("</?b[^>]*>","",Content)
Content=qdxw_ReplaceHtml("</?u[^>]*>","",Content)
Content=qdxw_ReplaceHtml("</?i[^>]*>","",Content)
Content=qdxw_ReplaceHtml("</?strong[^>]*>","",Content)
ClearHtml=Content
End Function
Function qdxw_ReplaceHtml(patrn, strng,content)
IF IsNull(content) Then
content=""
End IF
Set regEx = New RegExp ' ʽ
regEx.Pattern = patrn ' ģʽ
regEx.IgnoreCase = true ' úַСд
regEx.Global = True ' ȫֿԡ
qdxw_ReplaceHtml=regEx.Replace(content,strng) ' ִƥ
End Function
%>
ú:ClearHtml()
ʹ÷Ϊ:ClearHtml(Content),ContentΪĴŵı