1:遍历并输出表中值
<表ID = "TB"> <tr> <TD> </td> </tr> <tr> <td> </td> </tr> </table> function f(){var t = document.getelementbyid( "tb")。childnodes.item(0); 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 = "text/javascript"> function f(){var t = document.getelementyid(0); i = 0; i <t.childnodes.length; i ++){alert(t.childnodes(i).firstchild.firstchild.nodevalue); alert(t.childnodes(i).childnodes [1] .firstchild.checked); }} </script> <table id = "tb"> <tr> <td> 1234 </td> <td> <td> <input Type = "Checkbox"/> </td> <td> </td> </tr> <tr> <tr> <tr> <Td> 2234 </td> <td> <入力= "チェック=チェック="チェック= "チェック="チェック= "チェック="チェック= "チェック="チェック= " /> </td> <td> </td> </tr> <tr> <td> 3234 </td> <td> <入力タイプ= "チェックボックス"/> </td> <td> </td> </tr </table> </body> </html>