asp过滤HTML标签的函数
ASP #函数 #html2012-05-11 23:25
'============================== '格式化HTML '============================== Function Nohtml(ByVal t0) IF Len(t0)=0 Or IsNull(t0) Then Nohtml="" Exit Function End IF Dim Regs,Matches,Match Set Regs=New Regexp Regs.Ignorecase=True Regs.Global=True '过滤掉JS,Iframe Regs.pattern ="<script.+?/script>" t0=Regs.Replace(t0,"") Regs.pattern ="<iframe.+?/iframe>" t0=Regs.Replace(t0,"") '再过滤其他 Regs.Pattern="<.+?>" Set Matches=Regs.Execute(t0) IF Matches.Count>0 Then For Each Match In Matches t0=Replace(t0,Match.value,"") Next End IF t0=Replace(t0," ","") t0=Replace(t0,vbCrLf,"") t0=Replace(t0," ","") t0=Replace(t0," ","") t0=Replace(t0,CHR(9),"") t0=Replace(t0,CHR(13),"") t0=Replace(t0,CHR(10),"") t0=Replace(t0,CHR(22),"") Set Regs=Nothing Nohtml=t0 End Function
相关文章
- ASP在线备份与恢复sqlserver数据库 2012/05/11
- ASP伪静态下实现utf-8文件缓存 2012/05/11
- ASP用iframe批量生成静态页面的写法 2012/05/11
- ASP读取远程文件并保存到本地的代码 2012/05/11
- 出现msxml3.dll 错误 '800c0005'解决方法 2012/05/11
- ASP中获取当前页面的地址与参数的函数 2012/05/11
- ASP获取一个数字的个位、十位、百位的函数 2012/05/11
- ASP的Fix、Int、Round、CInt函数用法 2012/05/11
- ASP备份SQL Server数据库 2012/05/11
- ASP下ajax抓取中国天气网天气的代码 2012/05/11