var isIE = navigator.userAgent.indexOf("compatible") > -1 && navigator.userAgent.indexOf("MSIE") > -1;
var isWin = (navigator.platform == "Win32") || (navigator.platform == "Windows");
var EventUtil = new Object;
EventUtil.addEventHandler = function(eventName, eventElement, eventHandler){
if (eventElement.addEventListener) {
eventElement.addEventListener(eventName, eventHandler, false);
}
else
if (eventElement.attachEvent) {
eventElement.attachEvent('on' + eventName, eventHandler);
}
else {
eventElement["on" + eventName] = eventHandler;
}
}
EventUtil.removeEventHandler = function(eventName, eventElement, eventHandler){
if (eventElement.removeEventListener) {
eventElement.removeEventListener(eventName, eventHandler, false);
}
else {
if (eventElement.detachEvent) {
eventElement.detachEvent('on' + eventName, eventHandler);
}
else {
eventElement["on" + eventName] = null;
}
}
}
EventUtil.getEvent = function(){
if (window.event) {
return this.formatEvent(window.event);
}
else {
return EventUtil.getEvent.caller.arguments[0];
}
}
不解释了,自己去体会它的妙处吧...