码迷,mamicode.com
首页 > 编程语言 > 详细

JavaScript.延长作用域链

时间:2015-10-25 00:57:28      阅读:233      评论:0      收藏:0      [点我收藏+]

标签:

<!DOCTYPE html>
<html>
<head>
    <title>Execution Context Example 3</title>
    <script type="text/javascript">
        function buildUrl() {
            var qs = "?debug=true";
            
            with(location) {
                var url = href + qs;
            }
            
            return url;
        }
        
        var result = buildUrl();
        alert(result);
    </script>

</head>
<body>
  
</body>
</html>

技术分享

JavaScript.延长作用域链

标签:

原文地址:http://www.cnblogs.com/fatoland/p/4908072.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!