一聚教程网:一个值得你收藏的教程网站

热门教程

asp 过滤简单html代码程序

时间:2022-07-02 22:35:48 编辑:袖梨 来源:一聚教程网


 Public Function HTMLEncode(fString)
  If Not IsNull(fString) Then
   fString = replace(fString, ">", ">")
   fString = replace(fString, "<", "<")
   fString = Replace(fString, CHR(32), " ")  
   fString = Replace(fString, CHR(34), """)
   fString = Replace(fString, CHR(39), "'")
   fString = Replace(fString, CHR(9), " ")
   fString = Replace(fString, CHR(13), "")
   fString = Replace(fString, CHR(10) & CHR(10), "

")
   fString = Replace(fString, CHR(10), "
")
   HTMLEncode = fString
  End If
 End Function
 
 '==============================
 '函 数 名:HTMLDncode
 '作    用:字符转回函数
 '参    数:需要转换的文本fString
 '==============================
 Public Function HTMLDncode(fString)
  If Not IsNull(fString) Then
   fString = Replace(fString, ">",">" )
   fString = Replace(fString, "<", "<")
   fString = Replace(fString, " ", CHR(32))
   fString = Replace(fString, " ", CHR(9))
   fString = Replace(fString, """, CHR(34))
   fString = Replace(fString, "'", CHR(39))
   fString = Replace(fString, "", CHR(13))
   fString = Replace(fString, "

",CHR(10) & CHR(10) )
   fString = Replace(fString, "
",CHR(10) )
   HTMLDncode = fString
  End If
 End Function

热门栏目