window.onload = function choice() {
var tab = document.getElementById("tabs");
var ul = tab.getElementsByTagName("ul")[0];
var div = tab.getElementsByTagName("div");
var li = ul.getElementsByTagName("li");
for (var i = 0;i<li.length;i++){
li[i].index = i;
li[i].onclick = function(){
for(var n = 0;n<li.length;n++){
this.className = "";
div[n].className = "hide";
}
this.className = "on";
div[this.index].className = "";
}
}
}
添加回答
举报
0/150
提交
取消