Get the value of a cell table when clicking on it

A

Anonymous

Guest
This function will alert the value of each table cell:
Code:
    function GetCellValues() {
        var table = document.getElementById('mytable');
        for (var r = 0, n = table.rows.length; r < n; r++) {
            for (var c = 0, m = table.rows[r].cells.length; c < m; c++) {
                alert(table.rows[r].cells[c].innerHTML);
            }
        }
    }
Hope that helps,
Jon
 
Back
Top