1
我有这个功能,我调用的onload:设置事件动态
function InitAll(){
document.getElementById("div1").onmouseover = function(){Foo(event,this);};
document.getElementById("div1").onmouseout = function(){Foo(event,this);};
}
function Foo(e, handler){
document.getElementById("label1").innerHTML=e.type;
}
在IE它的工作原理,我得到正确的e.type,但在Firefox它并不:
事件没有定义
但如果我设置静态的事件,如:
<div id="div1" onmouseover="Foo(event,this);" onmouseout="Foo(event,this);" >
它适用于这两种浏览器。
我错过了什么?某种封闭?
或'e = e || window.event;' – 2010-02-06 14:01:49
@Andy E - 这正是我的想法,但我被卡在C#(??)中的短路操作符,我知道这是不对的。我会更新。 – tvanfosson 2010-02-06 14:41:49
thnak你的。 – ronik 2010-02-06 14:47:45