KissCss

addEvent

function addEvent(elm, evType, fn, useCapture) {
if (elm.addEventListener) {
elm.addEventListener(evType, fn, useCapture);
//DOM2.0
return true;
}
else if (elm.attachEvent) {
var r = elm.attachEvent(\'on\' + evType, fn);//IE5+
return r;
}
else {
elm[\'on\' + evType] = fn;//DOM 0
}
}

posted on 2011-03-08 16:24  arvin0319  阅读(218)  评论(0编辑  收藏  举报

导航