垂直下拉菜单

通过for循环与className控制

for(var i = 0; i < dd1.length; i++) {
dd1[i].onclick = function() {

if(this.children[1].className == "hiddle"){
this.children[1].className = "dl2";
return;
}else{
for(var j = 0; j < dl2a.length; j++) {
dl2a[j].className = "dl2";
}
}
if(this.children[1].className == "dl2") {
this.children[1].className = "hiddle";
}else
{
this.children[1].className = "dl2";
}
}
}

原文地址:https://www.cnblogs.com/clj9291/p/9555316.html