js,php,asp中的html编码解码

来源:互联网 发布:apache mac 编辑:程序博客网 时间:2024/05/17 10:38

<% 

 '相当于php中的htmlspecialchars()

' Convert special characters to HTML entities.   
function htmlspecialchars(someString)       
' Critical that ampersand is converted first, since all entities contain them.       
htmlspecialchars = replace(replace(replace(replace(someString, "&", "&amp;"), ">", "&gt;"), "<", "&lt;"), """", "&quot;")   
end function   

 

 '相当于php中的htmlspecialchars() 
' Convert HTML entities to special characters.   
function htmlspecialchars_decode(someString)       
htmlspecialchars_decode = replace(replace(replace(replace(someString, "&amp;", "&"), "&gt;", ">"), "&lt;", "<"), "&quot;", """")   
end function
%>

 

js中对html编码解码

编码encodeURIComponent()
解码decodeURIComponent()

0 0
原创粉丝点击