Home  >  Article  >  php教程  >  Asp clears style, javascript, css code in html

Asp clears style, javascript, css code in html

高洛峰
高洛峰Original
2016-11-24 09:24:281308browse

Asp clears style, javascript, css code in html

<%
Function RemoveHTML(str)
Dim objRegExp, Match,strHTML
if isnull(str) then
str=""
end if
strHTML=str
strHTML=replace(replace(replace(strHTML,vblf,""),vbcr,""),vbcrlf,"")
Set objRegExp = New Regexp
objRegExp.IgnoreCase = True
objRegExp.Global = True
objRegExp.Pattern = "<script[^>]*?>.*?</script>"
strHTML = objRegExp.Replace(strHTML,"")
objRegExp.Pattern = "<style[^>]*?>.*?</style>"
strHTML = objRegExp.Replace(strHTML,"")
objRegExp.Pattern = "<. ?>"
strHTML = objRegExp.Replace(strHTML,"")
Set objRegExp = Nothing
RemoveHTML=strHTML
End Function
%>


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn