1: 遍历并输出 Tabel 中值
<Table id = "tb"> <tr> <td> </td> </tr> <tr> <td> </td> </tr> </boable> fungsi f () {var t = document.getElementById ("tb"). childnodes.item (0); for (var i = 0; i <t.childes. j = 0; j <t.childnodes (i) .childnodes.length; j ++) {alert (t.childnodes (i) .childnodes (j) .innerText);}}}2: 遍历 Tabel , 读取 kotak centang 状态和其他 kolom 值
<! Doctype html public "-// w3c // dtd xhtml 1.0 transisi // en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns = "http://www.w3.org/1999/xhtml"> <head> <Title> halaman tanpa judul </iteme> </head> <body onload = "f ()"> <script type = "text/javascript"> function f () {var t = document.getelementbyid ("Text/Javascript"). i = 0; i <t.childnodes.length; i ++) {waspada (t.childnodes (i) .firstchild.firstchild.nodevalue); alert (t.childnodes (i) .childnodes [1] .firstchild.checked); }} </script> <table id = "tb"> <tr> <td> 1234 </td> <td> <input type = "centang kotak"/> </td> <td> </td> </tr> <td> 2234 </td> <td> <input = "checkbox =" 2234 </td> <td> <tdpbox " /> </td> <td> </td> </tr> <tr> <td> 3234 </td> <td> <input type = "kotak centang"/> </td> <td> </td> </tr> </jable> </body> </html>