Why IE alert 'unknow'
by Lien Z
HTML
<button id='btn1'>Click 1 !!</button>
<button id="btn2">Click 2 !!</button>
JavaScript
var btn1EventObj = null;
document.getElementById('btn1').onclick = function() {
btn1EventObj = window.event;
alert(btn1EventObj.srcElement.id);
}
document.getElementById('btn2').onclick = function() {
alert(btn1EventObj === window.event); // false
alert(btn1EventObj.srcElement === window.event.srcElement); // true :
//it should alert false but true ,
//so in MSIE,every time an event has been fired ,it will be only one Event Object, and all event share this Event Object;
alert(btn1EventObj.srcElement.id); // btn2 :
// as we think it should be output 'btn2', but it alert 'btn2 ' ,and this is make sure that the theory is correct:
// all the Event are all share one Evnet Object at all.
}