我需要从具有文本字段的表格单元格中提取值。
就我而言,我得到如下结果:
input type="text" name="test1" onchange="myFunction()
但我想从文本字段中获取值。
我有这个功能。
function GetTableCells(){
var oTable = document.getElementById('cell_values');
//gets table
var rowLength = oTable.rows.length;
//gets rows of table
for (i = 0; i < rowLength; i++){
//loops through rows
var oCells = oTable.rows.item(i).cells;
//gets cells of current row
var cellLength = oCells.length;
for(var j = 0; j < cellLength; j++){
//loops through each cell in current row
var cellVal = oCells.item(j).innerHTML;
alert(cellVal);
} } }