encodeURIComponent 方法
返回编码为统一资源标识符 (URI) 的有效组件的字符串。
function encodeURIComponent(encodedURIString : String) : String
参数
- encodedURIString
必选。 表示编码 URI 组件的字符串。
备注
encodeURIComponent 方法返回一个已编码的 URI。 如果将编码结果传递给 decodeURIComponent,则将返回初始的字符串。 因为 encodeURIComponent 方法编码所有字符,所以请注意该字符串是否表示路径,例如 /folder1/folder2/default.html。 斜杠字符将被编码,因此如果作为请求发送到 Web 服务器将无效。 如果字符串中包含多个 URI 组件,请使用 encodeURI 方法进行编码。