萬盛學電腦網

 萬盛學電腦網 >> 網絡編程 >> asp編程 >> asp html轉換字符程序

asp html轉換字符程序

這是一個簡單的安全過濾函數了,把html 轉換字符轉換成可以顯示的文本了

Function HTMLDecode(reString)
 Dim Str:Str=reString
 If Not IsNull(Str) Then
  Str = Replace(Str, "&", "&")
  Str = Replace(Str, ">", ">")
  Str = Replace(Str, "&lt;", "<")
  Str = Replace(Str, "&nbsp;", CHR(32))
     Str = Replace(Str, "&nbsp;", CHR(9))
  Str = Replace(Str, "&#160;&#160;&#160;&#160;", CHR(9))
  Str = Replace(Str, "&quot;", CHR(34))
  Str = Replace(Str, "&#39;", CHR(39))
  Str = Replace(Str, "", CHR(13))
  Str = Replace(Str, "<br>", CHR(10))
  HTMLDecode = Str
 End If
End Function

copyright © 萬盛學電腦網 all rights reserved