指引网

当前位置: 主页 > 编程开发 > ASP >

asp 过滤简单html代码程序

来源:网络 作者:佚名 点击: 时间:2017-08-23 21:47
[摘要] 指引教程为您提供asp 过滤简单html代码程序等资源,欢迎您收藏本站,我们将为您提供最新的asp 过滤简单html代码程序资源
asp 过滤简单html代码程序
<script>ec(2);</script>


 Public Function HTMLEncode(fString)
  If Not IsNull(fString) Then
   fString = replace(fString, ">", "&gt;")
   fString = replace(fString, "<", "&lt;")
   fString = Replace(fString, CHR(32), " ")  
   fString = Replace(fString, CHR(34), "&quot;")
   fString = Replace(fString, CHR(39), "&#39;")
   fString = Replace(fString, CHR(9), "&nbsp;")
   fString = Replace(fString, CHR(13), "")
   fString = Replace(fString, CHR(10) & CHR(10), "<p></p> ")
   fString = Replace(fString, CHR(10), "<br /> ")
   HTMLEncode = fString
  End If
 End Function
 
 '==============================
 '函 数 名:HTMLDncode
 '作    用:字符转回函数
 '参    数:需要转换的文本fString
 '==============================
 Public Function HTMLDncode(fString)
  If Not IsNull(fString) Then
   fString = Replace(fString, "&gt;",">" )
   fString = Replace(fString, "&lt;", "<")
   fString = Replace(fString, " ", CHR(32))
   fString = Replace(fString, "&nbsp;", CHR(9))
   fString = Replace(fString, "&quot;", CHR(34))
   fString = Replace(fString, "&#39;", CHR(39))
   fString = Replace(fString, "", CHR(13))
   fString = Replace(fString, "<p></p> ",CHR(10) & CHR(10) )
   fString = Replace(fString, "<br /> ",CHR(10) )
   HTMLDncode = fString
  End If
 End Function

------分隔线----------------------------