获得父节点,行索引,列索引

来源:互联网 发布:时间划分矩阵图片 编辑:程序博客网 时间:2024/06/05 18:54
<table border=1>
<tr>
<td onclick='alert("行数:"+(this.parentNode.rowIndex+1)+"/n列数:"+(this.cellIndex+1))'>点我</td>
<td onclick='alert("行数:"+(this.parentNode.rowIndex+1)+"/n列数:"+(this.cellIndex+1))'>点我</td>
<td onclick='alert("行数:"+(this.parentNode.rowIndex+1)+"/n列数:"+(this.cellIndex+1))'>点我</td>
</tr>
<tr>
<td onclick='alert("行数:"+(this.parentNode.rowIndex+1)+"/n列数:"+(this.cellIndex+1))'>点我</td>
<td onclick='alert("行数:"+(this.parentNode.rowIndex+1)+"/n列数:"+(this.cellIndex+1))'>点我</td>
<td onclick='alert("行数:"+(this.parentNode.rowIndex+1)+"/n列数:"+(this.cellIndex+1))'>点我</td>
</tr>
<tr>
<td onclick='alert("行数:"+(this.parentNode.rowIndex+1)+"/n列数:"+(this.cellIndex+1))'>点我</td>
<td onclick='alert("行数:"+(this.parentNode.rowIndex+1)+"/n列数:"+(this.cellIndex+1))'>点我</td>
<td onclick='alert("行数:"+(this.parentNode.rowIndex+1)+"/n列数:"+(this.cellIndex+1))'>点我</td>
</tr>
</table> 
原创粉丝点击