ตารางสำรวจจาวาสคริปต์
1. คำอธิบาย
วนซ้ำผ่านแถวและคอลัมน์ในตารางและพิมพ์ค่าของมัน
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> <meta http-equiv = "content-type" content = "text/html; charset = utf-8"/> <title> 1px Solid; } </style> <script type = "text/javaScript">/** * ตารางการสำรวจ JavaScript traversal */ฟังก์ชั่น aberstablerow () {// รับหมายเลขตารางลำดับ var tab = document.getElementById ("แท็บ"); // รับหมายเลขแถว var rows = tab.rows; // transpo row สำหรับ (var i = 1; i <rows.length; i ++) {// transip table column สำหรับ (var j = 0; j <rows [i] .cells.length; j ++) {// พิมพ์ค่าของการแจ้งเตือนแถวและคอลัมน์ ("th"+(i+1)+" คือ: "+แถว [i] .cells [j] .innerhtml); }}} </script> </head> <body> <table id = "tab" cellpadding = "0" cellpacing = "0"> <tr style = "border: #ccc 1px solid;"> <th> หมายเลขนักเรียน </th> <th> </th> <th> Sisi </td> <td> 20 </td> <td> หญิง </td> </tr> <tr> <td> 2014010102 </td> <td> lisan </td> <td> 21 </td> <td> ชาย </td> </td> <td> <td> <td> 22 </td> <td> หญิง </td> </tr> <tr> <td> 2014010104 </td> <td> Julie </td> <td> 23 </td> <td> ชาย </td> </tr> </html>3. บรรลุผลลัพธ์
(1) การเริ่มต้น
(2) คลิก "เดินทาง"
(3) คลิก "เดินทาง" อีกครั้ง