Forum Moderators: open
<table id = "craps">
<tr id = "row1"><td>some text</td></tr>
<tr id = "row2"><td>some more text</td></tr>
</table>
<a href = "javascript:alertRowId()">click me</a>
function alertRowId()
{
var crapsTable = document.getElementById("craps");
for (var i in crapsTable.rows)
{
var row = crapsTable.rows[i];
alert(row.id);
}
}
I don't understand why I got some undefineds, but I did get "row1" and "row2" to show.