jQuery遍历table

1、

$("table").find("tr").each(function(){
  $(this).find("td").each(function(){
  alert($(this).text());
  });
});

2

var tab = document.getElementById("table1");  //找到这个表格
var rows = tab.rows; //取得这个table下的所有行
for(var i=0;i<rows.length;i++)
{
for(var j=0;j<rows[i].cells.length;j++)
{
var cell = rows[i].cells[j];
alert("第"+(i+1)+"行第"+(j+1)+"格的数字是"+cell.innerHTML);
}
}
原文地址:https://www.cnblogs.com/leon719/p/3944664.html