码迷,mamicode.com
首页 > Web开发 > 详细

JS with

时间:2016-08-08 21:07:36      阅读:240      评论:0      收藏:0      [点我收藏+]

标签:

<script type="text/javascript">
    function Dog(){
        this.type="dog";
        this.tail=1;
        this.bark="wangwang";
    }
    var ahuang=new Dog();
    //alert(ahuang.bark);
    with(ahuang){
        alert(bark);
    }
</script>

with用于引用某js对象的已有属性

JS with

标签:

原文地址:http://www.cnblogs.com/dll-ft/p/5750823.html

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