1 : 遍历并输出 테이블 遍历并输出
<table id = "tb"> <td> <td> </td> </tr> <td> <td> </td> </tr> </table> 함수 f () {var t = document.getElementById ( "tb"). childnodes.item (var i = 0; i <t.childnodes.lenges; i ++) {for (ver j = 0;2 : 遍历 테이블, 读取 checkbox 状态和其他 열 值
<! 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> 제목없는 페이지 </title> </head> <body onload = "f ()"> <script type = "text/javaScript"> function f () {var t = document.getelementByid ( "tb"); i = 0; i <t.childnodes.length; i ++) {alert (t.childnodes (i) .firstchild.firstchild.firstchild.nodevalue); Alert (t.childnodes (i) .childnodes [1] .firstchild.checked); }} </script> <table id = "tb"> <tr> <td> <td> 1234 </td> <td> <입력 유형 = "Checkbox"/> </td> <td> </td> </td> <tr> <td> 2234 </td> <td> <입력 유형 = "Checked" "Checked" /> </td> <td> </td> </td> <tr> <td> 3234 </td> <td> <입력 유형 = "Checkbox"/> </td> <td> </td> </tr> </table> </body> </html>