📜  如何在javascript代码示例中迭代表行

📅  最后修改于: 2022-03-11 15:02:37.240000             🧑  作者: Mango

代码示例1
var table = document.getElementById("mytab1");
for (var i = 0, row; row = table.rows[i]; i++) {
   //iterate through rows
   //rows would be accessed using the "row" variable assigned in the for loop
   for (var j = 0, col; col = row.cells[j]; j++) {
     //iterate through columns
     //columns would be accessed using the "col" variable assigned in the for loop
   }  
}