前端 遍历行和列
var table = document.getElementsByTagName("table")[0]; //遍历列 for (var i = 0; i < table.rows[0].cells.length; i++) { console.log(table.rows[0].cells[i].innerText); if (!table.rows[0].cells[i].innerText) { } } //遍历行 for (var i = 0; i < table.rows.length; i++) { var row = table.rows[i]; console.log(row.cells[0].innerText); }