蝴蝶刀刀
a) function addEvent(el, type, fn){if(el.attachEvent){el['e’+type+fn] = fn;el[type+fn] = function(){el[‘e’+type+fn](window.event);}el.attachEvent(‘on’+type, el[type+fn]);}elseel.addEventListener(type, fn, false);}addEvent(window, 'load', init);function init() {var odiv = document.getElementByIdx_x("divtest");addEvent(odiv, 'onmouseover', onmousefunc);addEvent(odiv, 'onclick', onclickfunc);addEvent(odiv, 'onmouseout', mouseoutfunc);}function onmousefunc(){ ... }function onclickfunc(){ ... }