当前位置: 首页 > 网络学院 > 客户端脚本教程 > JavaScript > JavaScript decodeURIComponent(
The decodeURIComponent() function decodes a URI encoded with the encodeURIComponent() function.
decodeURIComponent()方法用于反编译一个经过encodeURIComponent()方法编译过的URI
decodeURIComponent(URIstring) |
Parameter 参数 | Description 注释 |
---|---|
URIstring URI字符串 | Required. The URI to be decoded 必选项。所要反编译的URI |
In this example we use decodeURIComponent() to decode a URI after encoding it:
在下面的例子中,我们将用decodeURIComponent()来反编译一个已被编译的URI:
<script type="text/javascript"> var test1="http://www.ruanchen.com/My first/" document.write(encodeURIComponent(test1)+ "<br />") </script> |
The output of the code above will be:
http%3A%2F%2Fwww.ruanchen.com%2FMy%20first%2F |
decodeURIComponent()
How to use decodeURIComponent() to decode a URI after encoding it.
如何用decodeURIComponent()来反编译一个已编译的URI