decodeURI () Definition and usage: the decodeURI () function decodes a URI encoded by the encodeURI () function.
Syntax: decodeURI (uristring)
Parameter description: Uristring required, a string containing the URI group to decode or other text to decode.
Return value: A copy of uristring, where the hexadecimal escape sequence is replaced by the character they represent.
decodeURIComponent () Definition and usage: the decodeURIComponent () function decodes a URI encoded by the encodeURIComponent () function.
Syntax: decodeURIComponent (uristring)
Parameter description: Uristring required, a string that contains the decoded URI component or other text to decode.
Return value: A copy of uristring, where the hexadecimal escape sequence is replaced by the character they represent.
The above is a description of the usage, but there are some problems in the actual use process:
#特殊符号进行进行编码传递参数的时候有一些不一样:
Test code as follows:
<Script>functionDemo () {vartext=Escape ("http://www.w3school.com.cn/My first/#qpp"); alert (text);}functiondemo1 () {vartest1="http://www.w3school.com.cn/My first/#qpp"alert (encodeURIComponent (test1));}functionDemo3 () {vartest1="http://www.w3school.com.cn/My first/#qpp"alert (decodeURI (test1));}functionMyApp (text) {vartext=unescape (text); alert (text);}
JS decodeURI () and encodeURI () differences, decodeuricomponent and encodeuricomponent differences