this为何不能用li[i]取代,this.indes为何不能用i取代?
window.onload=function(){ var ul1=document.getElementById('ul1'); var li=ul1.getElementsByTagName('li'); var tab=document.getElementById('tab-list'); var div=tab.getElementsByTagName('div'); for(var i=0;i<li.length;i++){ li[i].index=i; li[i].onmouseover=function(){ for(var j=0;j<li.length;j++){ li[j].className=""; div[j].className="hide"; } this.className="active"; div[this.index].className="show"; } } }