天哪,谁知道为什么 Internet Explorer (8) 不触发附加到窗口的事件?
attachEvent("onmousedown", function(){alert("here")}); //Doesn't work.
onmouseup = function(){alert("here 2")}; //Guess what? Doesn't work too.
当然,我什至不用说这适用于 Firefox、Opera 和 Chrome
addEventListener("mousedown", function(){alert("here")}, false)
onmouseup = function(){alert("here 2")};
attachEvent 在 div 上工作或*在此处插入任何 DOM 元素*,但我需要该事件是全局的。
最佳答案
尝试将其附加到文档中
关于javascript - 在窗口对象上附加鼠标事件在 Internet Explorer 8 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5336949/