日期:2014-05-16 浏览次数:20416 次
<div> <table></table> <div> <table></table> <div></div> <table></table> <div></div> </div> <table></table> <div> <table></table> <table></table> <table></table> <table></table> </div> <table></table> <div> <table></table> <table></table> <table></table> </div> </div>
var root_div = document.getElementById('div1'); var second_divs = root_div.children; for(var i = 0; i < second_divs.length; i++){ var second_div = second_divs[i]; if('div' === second_div.nodeName.toLowerCase()){ if(second_div.getElementsByTagName('table').length === second_div.children.length){ var three_divs = second_div.children; for(var j = 0; j < three_divs.length; j++){ three_divs[j].style.display = "inline"; } } } }