<table border=1 id="tb">
<tr>
<td> <input type=button value='click' onclick="alert(this.parentElement.parentElement.rowIndex)"> </td>
</tr>
</table>
<tr>
<td> <input type=button value='click' onclick="alert(this.parentElement.parentElement.rowIndex)"> </td>
</tr>
</table>
<tr>
<td onclick="alert(this.parentElement.rowIndex)"> <input type=button value='click' onclick="this.parentElement.parentElement.rowIndex"> </td>
</tr>
</table>
<tr>
<td>
<table border=1>
<tr><td>
<input type=button value='click'></td>
</tr>
</table></td>
</tr></table>
<tr>
<td>
<table border=1 id="hehe">
<tr>
<td>
<input type=button value='click' onclick="alert(document.getElementById('hehe').parentNode.parentNode.rowIndex)">
</td>
</tr>
</table>
</td>
</tr>
</table>