javascript如何判断一个对象是否是窗口

时间:2014-10-05 04:52:37   收藏:0   阅读:123
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script type="text/javascript">
    function isWindow( obj ) {
        /* jshint eqeqeq: false */
        return obj != null && obj == obj.window;
    };
    function test(){
        console.log(this);
        console.log(this.window);
        console.log(isWindow(this));
    }
    test();
</script> 
</body>
</html>

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!