window.event !== window.event in IE

Posted by iacnats on Stack Overflow See other posts from Stack Overflow or by iacnats
Published on 2012-09-18T01:57:11Z Indexed on 2012/09/18 3:38 UTC
Read the original article Hit count: 261

Filed under:

Code:

<html>
<head>
<script type="text/javascript">
  onload = function(){
    document.getElementById('btn1').onclick = function(){   
      if (window === window)  
        alert('window === window')
      else
        alert('window !== window');

      if (window.event === window.event)  
        alert('window.event === window.event')
      else
        alert('window.event !== window.event' );   
    }
  }
</script>
</head>
<body>
<button id="btn1" >click</button>
</body>
</html>

Result:

IE(i have tested IE6 - IE8) says:

window === window
window.event !== window.event

All other browsers say:

window === window
window.event === window.event

What's the reason for IE's response? Thanks.

© Stack Overflow or respective owner

Related posts about JavaScript