<scrippt>
window.onload = function(){
var oTab = oCont.getElementById("tab2");
var oA = oTab.getElementsByTagName("a")[0];
var o Divs = oTab.getElementsByTagName("div");
for(var i = 0,len = oA.length;i<len;i++){
oA[i].index = i;
oA[i].onclick = function(){
for(var n= 0;n<len;n++){
oA[n].style.backgroundColor = "rgb(299,299,299)";
oDivs[n].style.display="none";
}
this.style.backgroundColor="#fff";
oDivs[this.index].style.display = "block";
}
};
}
</scrippt>
<body>
<div class="tab1" id="tab2">
<a></a>
<div></div>
<a></a>
<div></div>
<a></a>
<div></div>
</div>
</body>
我是想点击每个<a>都能切换到下面的<div>