以后地位:首页 > 建站常识 > 列表

ASP过滤html函数只保留纯笔墨

点击: 次时候:2016/12/10关头词:ASP html 函数
<% Function RemoveHTML(strHTML)'过滤HTML代码的函数包含过滤CSS和JSStrHtml = WordStr(StrHtml,vbCrLf,"") StrHtml = WordStr(StrHtml,Chr(13)
ASP过滤html函数只保留纯笔墨
<%  Function RemoveHTML(strHTML)    '过滤HTML代码的函数包含过滤CSS和JS    StrHtml = WordStr(StrHtml,vbCrLf,"")   StrHtml = WordStr(StrHtml,Chr(13)&Chr(10),"")   StrHtml = WordStr(StrHtml,Chr(13),"")   StrHtml = WordStr(StrHtml,Chr(10),"")   StrHtml = WordStr(StrHtml," ","")   StrHtml = WordStr(StrHtml,"    ","")    Dim objRegExp, Match, Matches Set objRegExp = New Regexp  objRegExp.IgnoreCase = True objRegExp.Global = True  '取闭合的<>   objRegExp.Pattern = "<style(.+?)/style>"   '停止婚配   Set Matches = objRegExp.Execute(strHTML)  ' 遍历婚配调集,并替代掉婚配的名目   For Each Match in Matches   strHtml=WordStr(strHTML,Match.Value,"")   Next  '取闭合的<>   objRegExp.Pattern = "<script(.+?)/script>"   '停止婚配   Set Matches = objRegExp.Execute(strHTML)  ' 遍历婚配调集,并替代掉婚配的名目   For Each Match in Matches   strHtml=WordStr(strHTML,Match.Value,"")   Next  '取闭合的<>   objRegExp.Pattern = "<.+?>"   '停止婚配   Set Matches = objRegExp.Execute(strHTML)   ' 遍历婚配调集,并替代掉婚配的名目   For Each Match in Matches   strHtml=WordStr(strHTML,Match.Value,"")   Next  RemoveHTML=strHTML   Set objRegExp = Nothing   End Function  %>  
预定建站
收费供给网站优化
支付关头词