2013-03-08 102 views
0

参数e在Chrome,FF和IE 9中是正确的事件,但在IE 8和IE 7中为“未定义”。可在IE 9中使用F12 devtools重现浏览器模式:IE 8和文档模式:IE 8也。document.onmouseover和onmouseout事件参数在IE 8和IE7中未定义

注:此功能正常叫我 '只有' 的问题,e是不确定的...

<script> 
    document.onmouseover = function(e) { 
    // parameter e is the correct event in Chrome, FF and IE 9 
    // but 'undefined' in IE 8 and IE 7. Reproducable in IE 9 using F12 devtools 
    // Browser Mode: IE 8 and Document Mode: IE 8 also. 
    // NOTE: The function is called properly my 'only' problem that e is undefined 

    ... work with parameter e here 
} 
</script> 

任何想法? 您提前预约

+0

这是一个很长很长的已知问题,它的常见修复无处不在。你是否尝试寻找解决方案? – 2013-03-08 15:22:02

+0

Thx的评论。是的,我做到了。你也可以试试。即使现在,当我知道答案并且将答案作为搜索关键字很难找到时。顺便说一句,如果找到答案非常明显,那么提供至少一个链接会更有效率并且更有帮助。 – 2013-03-08 15:48:40

+0

如果您懒得阅读关于浏览器事件处理的任何初学者信息,就很难*找不到解决方案。 – 2013-03-08 15:50:45

回答

2

IE做不同事件,因此它不起作用。

document.onmouseover = function(e) { 
    e = e || window.event; 
}