您可以使用 HTML Table id 检索您的表格,并对每个单元格值进行如下处理。您需要以整数或浮点数或任何您想应用于单元格值的数字格式将应用转换应用于单元格值。<table id="cTable"> <tr> <td>L1</td> <td>L2</td> <td>L3</td> </tr> <tr> <td>M1</td> <td>M2</td> <td>M3</td> </tr></table><script> //get the table using the Table id var mTable = document.getElementById('cTable'); //get the number of rows of the table var rowLen = mTable.rows.length; //loop through rows for (i = 0; i < rowLen; i++){ //gets number of cells of current row var rowCells = mTable.rows.item(i).cells; //get the amount of cells of current row var cellLen = rowCells.length; //loop through each cell in the current row for(var j = 0; j < cellLen; j++){ // get your cell info here var cellVal = rowCells.item(j).innerHTML; // You can do the appropriate processing of numerical values below. alert(cellVal); } }</script>