JavaScript unescape()Function

函数参考手册JavaScript Global Functions

Definition and Usage

The unescape() function decodes a string encoded by escape().

Tip:Use the functionescape()to encode a string.

Note:The unescape() function has been removed from Web standards, so try not to use this function. You can usedecodeURI ordecodeURIComponent instead.

Syntax

unescape(string)

Parameters Description
string Required. The string to decode.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the unescape() function.


Tips and Notes

Note:unescape() cannot be used to decode URI (Uniform Resource Identifier, referred to as "URI"). To decode a URI, usedecodeURI()method.


Examples

Example

In this example we will use escape() to encode a string and then use unescape() to decode it:

var str="Need tips? Visit EXAMPLE!"; var str_esc=escape(str); document.write(str_esc + "<br>") document.write(unescape(str_esc))

Try it Yourself »


函数参考手册JavaScript Global Functions Other Extensions