剔除html中style,javascript,css代码
时间:2010-09-29 来源:龙圆
剔除页面中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%>
相关阅读 更多 +