A: 

You have to go back up through the DOM until you find the <tr> element.

function onclick_handler( event ) {
    var element = event.target;
    while( element.tagName != 'TR' && element.parentNode ) {
        element = element.parentNode;
    }
    return element.rowIndex;
}
sakabako
A: 
onclick="alert(this.parentNode.rowIndex);"

Unless you have a tbody type tag, then use parentNode twice. Or in jquery:

onclick="alert($(this).closest('tr').attr('rowIndex'));"
Yuriy Faktorovich
+1  A: 
$("yourtableselector td").click(function() {
    alert($(this).parents("tr").get(0).rowIndex);
});
jitter