1: 遍历并输出 Tableau 中值
<table id = "tb"> <tr> <td> </td> </tr> <tr> <td> </td> </tr> </pally> function f () {var t = document.getElementById ("tb"). j = 0; j <t.childnodes (i) .childnodes.length; j ++) {alert (t.childnodes (i) .childnodes (j) .InnerText);}}}2: 遍历 Table
<! Doctype html public "- // w3c // dtd xhtml 1.0 transitional // en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns = "http://www.w3.org/1999/xhtml"> <éread> <Title> Page intemplable </Title> </ Head> <Body Onload = "F ()"> <script type = "Text / Javascrip i = 0; i <t.childnodes.length; i ++) {alert (t.childnodes (i) .firstchild.firstchild.Nodevalue); alert (t.childnodes (i) .childnodes [1]. }} </ script> <table id = "tb"> <tr> <td> 1234 </td> <td> <input type = "checkbox" /> </td> <td> </td> </tr> <tr> <td> 2234 </td> <td> <entrée type = "checkbox" checked = "cheeded" /> </ td> <td> </ td> </ tr> <tr> <td> 3234 </td> <td> <entrée type = "Checkbox" /> </td> <td> </td> </ tr> </s table> </ body> </html>