1, encodeURI and decodeURI
[1] Syntax: encodeURI (String), decodeURI (String)
[2] Description: The decodeURI () function decodes the URI encoded by the encodeURI () function. Where the encryption value is: The hexadecimal escape sequence is replaced by the character they represent.
[3] Case:
The code is as follows |
Copy Code |
<script type= "Text/javascript" >
var test1= "Http://www.w3school.com.cn/My first/"
document.write (encodeURI (test1) + "<br/>") document.write (decodeURI (test1))
</script> |
2, encodeURIComponent and decodeURIComponent
[1] Syntax: encodeURIComponent (String), decodeURIComponent (String)
[2] Description: The decodeURIComponent () function decodes the URI encoded by the encodeURIComponent () function. Where the encryption value is: The hexadecimal escape sequence is replaced by the character they represent.
[3] Case:
The code is as follows |
Copy Code |
<script type= "Text/javascript" >
var test1= "Http://www.w3school.com.cn/My first/"
document.write (encodeURI (test1) + "<br/>") document.write (decodeURI (test1))
</script>
|
3. Escape and Unescape
[1] Syntax: Escape (String), Unescape (String)
[2] Description: The unescape () function decodes a string encoded by escape ().
[3] Case:
The code is as follows |
Copy Code |
<script type= "Text/javascript" >
var test1= "Visit w3school!"
Test1=escape (test1) document.write (test1 + "<br/>")
Test1=unescape (test1) document.write (test1 + "<br/>")
</script> |