收集整理 时间是: 02/06/06 下午 01:17:40.
文件名称: jsmthEncodeURIComponent.htm
页面标题: encodeURIComponent 方法  •  文件大小: 1943  •  最后更新: Mon, 06 Feb 2006 02:23:46 GMT

encodeURIComponent 方法

将文本字符串编码为一个统一资源标识符 (URI) 的一个有效组件。

encodeURIComponent(encodedURIString)

必选的 encodedURIString 参数代表一个已编码的 URI 组件。

说明

encodeURIComponent 方法返回一个已编码的 URI。如果您将编码结果传递给 decodeURIComponent,那么将返回初始的字符串。因为 encodeURIComponent 方法对所有的字符编码,请注意,如果该字符串代表一个路径,例如 /folder1/folder2/default.html,其中的斜杠也将被编码。这样一来,当该编码结果被作为请求发送到 web 服务器时将是无效的。如果字符串中包含不止一个 URI 组件,请使用 encodeURI 方法进行编码。

要求

版本 5.5

请参阅

decodeURI 方法 | decodeURIComponent 方法

应用于: Global 对象