1: 遍历并输出 Таблица 中值
<Таблица id = "tb"> <tr> <td> </td> </tr> <tr> <td> </td> </tr> </table> function f () {var t = document.getElementById ("tb"). j = 0; j <t.childnodes (i) .childnodes.length; j ++) {alert (t.childnodes (i) .childnodes (j) .innertext);}}}2: 遍历 Таблица , 读取 Флажок 状态和其他 столбец 值
<! 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"> <Head> <Title> Untitled Page </title> </head> <body onload = "f ()"> <script type = "text/javascript"> function f () {var t = decilemelementbyid ("tb"). i = 0; i <t.childnodes.length; i ++) {alert (t.childnodes (i) .firstchild.firstchild.nodevalue); alert (t.childnodes (i) .ChildNodes [1] .firstchild.Cecked); }} </script> <table id = "tb"> <tr> <td> 1234 </td> <td> <input type = "fackbox"/> </td> <td> </td> </tr> <tr> <td> 2234 </td> <td> <вход /> </td> <td> </td> </tr> <tr> <td> 3234 </td> <td> <input type = "fackbox"/> </td> <td> </td> </tr> </table> </body> </html>