JavaScript unescape() 函数

函数参考手册 JavaScript 全局函数

定义和用法

unescape() 函数可对通过 escape() 编码的字符串进行解码。

提示: 使用函数escape() 对字符串进行编码。

语法

unescape(string)

参数描述
string必需。要解码的字符串。


浏览器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

所有主要浏览器都支持 unescape() 函数。


提示和注释

注意: unescape()不能使用于对 URI(通用资源标识符:UniformResourceIdentifier,简称"URI")精选解码. 解码 URI 请使用 decodeURI() 方法。


实例

实例

在本例中,我们将使用 escape() 来编码字符串,然后使用 unescape() 对其解码:

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

尝试一下 »


函数参考手册 JavaScript 全局函数

0 个评论

要回复文章请先登录注册