[html5]html 过滤与敏感字符过滤转换程序

更新时间:2016-05-09    来源:html5教程    手机版     字体:

【www.bbyears.com--html5教程】

 Function HTMLEncode(str,isRequest)
  If isRequest = 1 Then
   str = safeRequest(str,0)
  End If
        If str = "" Or IsNull(str) Or IsEmpty(str) Then
   HTMLEncode = ""
   Exit Function
  End If
"  str = Replace(str,"&","&")
  str = Replace(str,"<","<")
  str = Replace(str,">",">")
  str = Replace(str,""","'")
  str = Replace(str,"""",""")
  str = Replace(str," ","  ")
  str = Replace(str,vbcr,"")
"  str = Replace(str,vblf & vblf,"

")
"  str = Replace(str,vblf,"
")
  HTMLEncode = Str
 End Function

    Public Function HTMLDecode(str)
        If str = "" Or IsNull(str) Or IsEmpty(str) Then
   HTMLDecode = ""
   Exit Function
        End If
  str = Replace(str,"&","&")
  str = Replace(str,"<","<")
  str = Replace(str,">",">")
  str = Replace(str,"'",""")
  str = Replace(str,""","""")
  str = Replace(str,"  "," ")
"  str = Replace(str,"

",vbcrlf)
"  str = Replace(str,"
",vblf)
  HTMLDecode = str
    End Function

本文来源:http://www.bbyears.com/wangyezhizuo/23741.html

猜你感兴趣