<table>
<tr>
<td>
<input type="checkbox" onClick="alert(this.parentNode.parentNode.rowIndex)"></td>
</tr>
</table>
rowIndex是行索引,它是相对于table的行数来讲的
rowIndex是tr的属性,而你用的this指的是checkbox
<tr>
<td>
<input type="checkbox" onClick="alert(this.parentNode.parentNode.rowIndex)"></td>
</tr>
</table>
rowIndex是行索引,它是相对于table的行数来讲的
rowIndex是tr的属性,而你用的this指的是checkbox
<TR>
<TD></TD>
<TD></TD>
</TR>
<TR>
<TD></TD>
<TD></TD>
</TR><TR>
<TD></TD>
<TD><INPUT TYPE="button" VALUE="rowindex" onClick="alert(this.parentNode.parentNode.rowIndex)"></TD>
</TR>
</TABLE>