Posted in Javascript onDecember 17, 2008
<strong>数据源:</strong> <ul> <li>三水点靠木</li> <ul> <li>a_1</li> <li>a_2</li> <li>a_3</li> </ul> <li>3water.com</li> <li>www.kanshule.com</li> </ul> <script> document.write("<strong>取外层ul的li信息:</strong><br>"); var tree1 = document.getElementsByTagName("ul")[0].childNodes; for (var i = 0;i < tree1.length;i++){ document.write(tree1[i].innerHTML); } document.write("<br><br><strong>取内层ul的li信息:</strong><br>"); var tree2 = document.getElementsByTagName("ul")[1].childNodes; for (var i = 0;i < tree2.length;i++){ document.write(tree2[i].innerHTML); } </script>
Javascript 获取LI里的内容
声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@