JavaScript unescape() 函數

定義和用法
unescape() 函數可對通過 escape() 編碼的字串進行解碼。
提示: 使用函數escape() 對字串進行編碼。
語法
unescape(string)
參數 | 描述 |
---|---|
string | 必需。要解碼的字串。 |
流覽器支持
所有主要流覽器都支持 unescape() 函數。
提示和注釋
注意: unescape()不能使用於對 URI(通用資源識別字:UniformResourceIdentifier,簡稱"URI")精選解碼. 解碼 URI 請使用 decodeURI() 方法。
實例
實例
在本例中,我們將使用 escape() 來編碼字串,然後使用 unescape() 對其解碼:
var str="Need tips? Visit zaixian!";
var str_esc=escape(str);
document.write(str_esc + "<br>")
document.write(unescape(str_esc))
