Array.prototype.inArray = 함수(값) {
var i;
for (i=0; i < this.length; i ) {
if (this[i] === value) {
true를 반환합니다.
}
}
false를 반환합니다.
};
function addEvent( obj, type, fn ) {
if (obj.addEventListener) {
obj.addEventListener( type, fn, false );
EventCache.add(obj, type, fn);
}
else if (obj.attachEvent) {
obj["e" type fn] = fn;
obj[type fn] = function() { obj["e" type fn]( window.event ); }
obj.attachEvent( "on" type, obj[type fn] );
EventCache.add(obj, type, fn);
}
else {
obj["on" type] = obj["e" type fn];
}
}
var EventCache = function(){
var listEvents = [];
반환 {
listEvents : listEvents,
추가 : function(node, sEventName, fHandler){
listEvents.push(arguments);
},
플러시 : function(){
var i, item;
for(i = listEvents.length - 1; i >= 0; i = i - 1){
항목 = listEvents[i];
if(item[0].removeEventListener){
item[0].removeEventListener(item[1], item[2], item[3]);
};
if(item[1].substring(0, 2) != "on"){
item[1] = "on" item[1];
};
if(item[0].detachEvent){
item[0].detachEvent(item[1], item[2]);
};
item[0][item[1]] = null;
};
}
};
}();
addEvent(window,'unload',EventCache.flush);