慕桂英9545975
2016-05-03 15:56
function drag(){ var loginState=document.getElementById('loginState'), stateList=document.getElementById('loginStatePanel'), lis=stateList.getElementsByTagName('li'), stateTxt=document.getElementById('login2qq_state_txt'), loginStateShow=document.getElementById('loginStateShow'); /* loginState.onclick=function(e){ e = e || window.event; if(e.stopPropagation){ e.stopPropagation(); }else{ e.cancelBubble=true; }*/ stateList.style.display='block'; } // 鼠标滑过、离开和点击状态列表时 for(var i=0,l=lis.length;i<l;i++){ lis[i].onmouseover=function(){ this.style.background='#567'; } lis[i].onmouseout=function(){ this.style.background='#FFF'; } /*lis[i].onclick=function(e){ e = e || window.event; if(e.stopPropagation){ e.stopPropagation(); }else{ e.cancelBubble=true; }*/ var id=this.id; stateList.style.display='none'; stateTxt.innerHTML=getByClass('stateSelect_text',id)[0].innerHTML; loginStateShow.className=''; loginStateShow.className='login-state-show '+id; } }
算了,我知道怎么做了,是我看错了才一直没写对
DOM事件探秘
99532 学习 · 1298 问题
相似问题