URI 编码方法 encodeURIComponent()

2017-06-16 15:03:00
admin
原创
481
<!DOCTYPE html>
<html>
<head>
    <title>Global Object URI Encoding Example</title>
    <script type="text/javascript">
    
        var uri = "http://www.wrox.com/illegal value.htm#start";
        
        //"http://www.wrox.com/illegal%20value.htm#start"
        alert(encodeURI(uri));
        
        //"http%3A%2F%2Fwww.wrox.com%2Fillegal%20value.htm%23start"
        alert(encodeURIComponent(uri));


        
    </script>
</head>
<body>

</body>
</html>
  • QQ讨论群
  • 关注微信
    • 欢迎咨询
    • 欢迎加入QQ群 16506021
  • 公众号:源宝网络