1: 遍历并输出ตาราง中值
<table id = "tb"> <tr> <td> </td> </tr> <tr> <td> </td> </tr> </table> ฟังก์ชั่น f () {var t = document.getElementById ("tb") j = 0; j <t.childnodes (i) .childnodes.length; j ++) {แจ้งเตือน (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> หน้าไม่มีชื่อ </title> </head> <body onload = "f ()"> <script type = "text/javaScript"> ฟังก์ชั่น f () i = 0; i <t.childnodes.length; i ++) {แจ้งเตือน (t.childnodes (i) .firstchild.firstchild.nodevalue); แจ้งเตือน (t.childnodes (i) .childnodes [1]. }} </script> <table id = "tb"> <tr> <td> 1234 </td> <td> <อินพุต type = "ช่องทำเครื่องหมาย"/> </td> <td> </td> </tr> <tr> <td> 2234 </td> <td> /> </td> <td> </td> </tr> <tr> <td> 3234 </td> <td> <อินพุตประเภท = "ช่องทำเครื่องหมาย"/> </td> <td> </td> </tr> </table>