How to select of the with javascript?
前端 未结 6 912
忘了有多久
忘了有多久 2020-12-15 22:35

I know this is very easy question, but I couldn\'t find the answer anywhere. Only answers are the ones using jQuery, not pure JS. I\'ve tried the code below and it doesn\'t

6条回答
  •  南笙
    南笙 (楼主)
    2020-12-15 23:08

    There are also the rows and cells members;

    var t = document.getElementById("tbl");
    for (var r = 0; r < t.rows.length; r++) {
        for (var c = 0; c < t.rows[r].cells.length; c++) {
            alert(t.rows[r].cells[c].innerHTML)
        }
    }
    

提交回复
热议问题