js dom 添加类
var sheng = document.getElementById("sheng"); var falge =0; sheng.onclick = function() { if(this.parentNode.classList.contains('linkage-selected')){ //检查类 this.parentNode.classList.remove("linkage-selected"); //添加类 //this.nextElementSibling.style.display="none"; }else{ this.parentNode.classList.add("linkage-selected"); //this.nextElementSibling.style.display=" block"; //设置样式 } }
//dd下的单击事件 var sheng_dds = sheng.parentNode.getElementsByTagName("dl")[0].children; //获得子节点