1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| function emit(element,type, func){ if (element.addEventListener) { emit = function(element,type,func){ element.addEventListener(type,func,false) } } else if(element.attachEvent) { emit = function(element,type,func){ element.attachEvent('on'+type, func); } } else { emit = function(element,type,func){ element['on'+type] = func } } emit(element,type,func) } emit(box,'click',func); emit(box,'click',func);
|