请问大神这种情况我这样写对不对??
<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>