How do I get data from a data table in javascript?

今天药忘吃喽~ 2022-03-29 06:11 250阅读 0赞

This is how I accomplished reading a table in javascript. Basically I drilled down into the rows and then I was able to drill down into the individual cells for each row. This should give you an idea

var oTable = document.getElementById(‘myTable’);
//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


}
}
UPDATED - TESTED SCRIPT




A1 A2 A3
B1 B2 B3

发表评论

表情:
评论列表 (有 0 条评论,250人围观)

还没有评论,来说两句吧...

相关阅读