HLJ 发布于
2018-08-21 14:27:11

JavaScript decodeURI()函数

JavaScript decodeURI()函数
decodeURI()函数用于解码URI。
<!DOCTYPE html>
<html>
<body>
<p>Click the button to decode a URI after encoding it.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
    var uri = "my test.asp?name=stale&car=saab";
    var enc = encodeURI(uri);
    var dec = decodeURI(enc);
    var res = "Encoded URI: " + enc + "<br>" + "Decoded URI: " + dec;
    document.getElementById("demo").innerHTML = res;
}
</script>
</body>
</html>


当前文章内容为原创转载请注明出处:http://www.good1230.com/detail/2018-08-21/190.html
最后生成于 2023-06-18 18:38:29
此内容有帮助 ?
0