日期:2014-05-16  浏览次数:20314 次

一个window.event的很简单的问题
为什么我使用window.event.ctrlKey时总是说event   has   no   properties的?我用的是firefox.

------解决方案--------------------
document.onkeydown = function(e)
//这里就是IE跟FF的事件句柄传递的不同之处,IE里的事件对象就是window.event,而FF是通过绑定的函数的第一个参数默认的传进来的.
e = window.event || e;
//表示,如果window.event == null则表e参数值,因为FF里没有window.event对象,而IE里有.
e = window.event || arguments.callee.caller.arguments[0];
//表示如果window.event == null 则取函数的第一个参数...