1: 遍历并输出 الجدول 中值
<table id = "tb"> <tr> <td> </td> </tr> <tr> <td> </td> </tr> </table> وظيفة f () {var t = document.getElementByid 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" xmlns = "http://www.w3.org/1999/xhtml"> <head> <title> page بدون عنوان </title> </head> <body onload = "f () 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> <type type = "checkbox"/> </td> <td> </td> </td> <tr> <td> 2234 </td> <td> <td> <nccectbox "checked =" checked " /> </td> <td> </td> </tr> <tr> <td> 3234 </td> <td> <type type = "checkbox"/> </td> <td> </td> </tr> </table> </body> </html>