Posted in Javascript onDecember 18, 2009
function getEvent() { var i = 0; if(document.all){ return window.event; } func = getEvent.caller; while(func != null) { var arg0 = func.arguments[0]; if(arg0) { if(arg0.constructor == MouseEvent) { return arg0; } } func = func.caller; } return null; }
函数中要引用须传参e才能等到:
function buttonOver(e) { e = getEvent(); var obj = e.srcElement || e.target; if (obj.runtimeStyle){ obj.runtimeStyle.cssText = "background-color:#FFFFFF"; } else obj.style.background = "#FFFFFF"; }
替代window.event.srcElement效果的可兼容性的函数
声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@