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

<!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>

 

posted @ 2014-10-05 02:25  wuhn  阅读(440)  评论(0编辑  收藏  举报