ついカッとなった


// Event拡張
Function.prototype.applyEventWithDOM = function(element, type, args, ignoreEvent) {
var self = this;
var _chk = function(event, args, ignoreEvent){
var ev = event || window.event;
if (ignoreEvent != true)
if (typeof args[0] !== typeof ev)
args.unshift(ev)
else if (typeof args[0] === typeof ev)
args[0] = ev

self.apply(self, args);
}
if (element.addEventListener) {
element.addEventListener(type, function(event){
_chk(event, args, ignoreEvent)
}, false);
}
else {
element.attachEvent('on'+type, function(event){
_chk(event, args, ignoreEvent)
});
}
}
ついカッとなってFunctionオブジェクト拡張してみた。
あほすぎるwwww


changeSearchFocus.applyEventWithDOM($('search01'), 'click', [1,0]);
実行する関数.applyEventWithDOM(監視するエレメント, イベント, 引数);