get: function(e) {
return window.event ? window.event : e;
},
getTarget: function(e) {
return e.target || e.srcElement;
},
add: function(obj, evt, fnc, capture) {
if (obj.addEventListener) {
obj.addEventListener(evt, fnc, capture);
return true;
} else if (obj.attachEvent) {
return obj.attachEvent('on' + evt, fnc);
} else {
obj['on' + evt] = fnc;
}
},
remove: function(obj, evt, fnc, capture) {
if (obj.removeEventListener) {
obj.removeEventListener(evt, fnc, capture);
} else if (obj.detachEvent) {
obj.detachEvent('on' + evt, fnc);
} else {
obj['on' + evt] = null;
}
},
addOnLoad: function(fnc) {
var oldOnLoad = window.onload;
if (typeof window.onload != 'function') {
window.onload = fnc;
} else {
window.onload = function() {
oldOnLoad();
fnc();
}
}
}
};
0 comments:
Post a Comment