javascript跨浏览器事件处理,javascript事件处理机制,javascript跨浏览器事件
web前端-js教程
java穿越火线源码,ubuntu 显示半屏,tomcat中jsp不编译,爬虫宠物 蝎子,php宝塔开启错误日志,seo 教科书lzw
跨浏览器的事件处理程序 function $(id){ return document.getElementById(id); } var EventUtil={ fnCount:0 ,fnData:{} ,addHandler:function(element,type,handler){ this.fnCount++; handler.fid = this.fnCount; var _fn = handler; handler = function(){ _fn.call(element); }; this.fnData[this.fnCount] = handler; if(element.addEventListener){ element.addEventListener(type,handler,false); } else if(element.attachEvent){ element.attachEvent("on"+type,handler); } else { element["on"+type]=handler; } } ,removeHandler:function(element,type,handler){ handler = this.fnData[handler.fid]; if(element.removeEventListener){ element.removeEventListener(type,handler,false); }else if(element.detachEvent){ element.detachEvent("on"+type,handler); }else{ element["on"+type]=null; } } } var btn=$("myBtn"); var unbtn = $('unlisten'); var bindFn1=function(){ alert(this.id); }; var bindFn2=function(){ alert('2'); }; EventUtil.addHandler(btn,"click",bindFn1); EventUtil.addHandler(btn,"click",bindFn2); //EventUtil.removeHandler(btn,"click",bindFn1); EventUtil.addHandler(unbtn,"click",function(){ EventUtil.removeHandler(btn,"click",bindFn1); });
网页小游戏站源码下载,ubuntu查看更新源,在工程中添加tomcat,ocr 爬虫技术,php 建站cms,云阳专业性seo推广代运营lzw