javaScript之跨浏览器的事件对象
跨浏览器的兼容代码
var eventHandler = { addHandler: function(element, type, handler){}, removeHandler: function(element, type, handler){}, getEvent: function(event){ return event ? event : window.event; }, preventDefault: function(event){ if(event.preventDefault){ event.preventDefault(); }else{ event.returnValue = false; } }, stopPropagation: function(event){ if(event.stopPropagation){ event.stopPropagation(); }else{ event.cancelBubble = true; } } };