// JavaScript Document?? var Yi=document.getElementsByTagName("a"); function Re(){ for(var i=0;i<Yi.length;i++){ popUp=function(winURL){//window對象的open()方法來創(chuàng)建新的瀏覽器窗口 window.open(winURL,"popUp","width=320,height=480");}? ? popUp(this.getAttribute('href'));? ? ? ? return false; } } var Tc=document.getElementById("Tc");/*function Rc(){//Dom0級事件:var Fan=document.getElementsByTagName("a");for(var i=0;i<Fan.length;i++){Fan[i].onclick=function(){"Fan[i]= popUp(this.href);return false;}}} Rc();*/? var lilike={ //添加句柄 Nuse:function(Dc,type,handler){ if(Dc.addEventListener){ Dc.addEventListener(type,handler,false); ?//google等瀏覽器 Dom二級事件 }else if(Dc.attachEvent){ Dc.attachEvent('on'+type,handler);//ie瀏覽器 DOM二級事件 }else{ Dc['on'+type]=handler; //DOM 0級事件 } } } lilike.Nuse(Yi[i],'click',Re);
js Dom跨瀏覽器問題
亂也
2016-11-21 18:29:09