I\'m learning JavaScript and recently I have been experimenting with Mouse events, trying to understand how they work.
var table = document.getElementById("tableID");
if (table != null) {
for (var i = 0; i < table.rows.length; i++) {
for (var j = 0; j < table.rows[i].cells.length; j++)
table.rows[i].cells[j].onclick = function () {
tableText(this);
};
}
}
function tableText(tableCell) {
alert(tableCell.innerHTML);
}
is an example of what you could do. DEMO