读书人

支持IE跟Firefox的得到表格的当前行号

发布时间: 2012-11-06 14:07:00 作者: rapoo

支持IE和Firefox的得到表格的当前行号和列号

<table border="1">  <tr>    <td><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></td>  </tr>  <tr>    <td><table   border=1>        <tr>          <td   onclick='alert("行数:"+(this.parentNode.rowIndex+1)+"\n列数:"+(this.cellIndex+1))'>点我1</td>          <td   onclick='alert("行数:"+(this.parentNode.rowIndex+1)+"\n列数:"+(this.cellIndex+1))'>点我1</td>          <td   onclick='alert("行数:"+(this.parentNode.rowIndex+1)+"\n列数:"+(this.cellIndex+1))'>点我1</td>        </tr>        <tr>          <td   onclick='alert("行数:"+(this.parentNode.rowIndex+1)+"\n列数:"+(this.cellIndex+1))'>点我1</td>          <td   onclick='alert("行数:"+(this.parentNode.rowIndex+1)+"\n列数:"+(this.cellIndex+1))'>点我1</td>          <td   onclick='alert("行数:"+(this.parentNode.rowIndex+1)+"\n列数:"+(this.cellIndex+1))'>点我1</td>        </tr>        <tr>          <td   onclick='alert("行数:"+(this.parentNode.rowIndex+1)+"\n列数:"+(this.cellIndex+1))'>点我1</td>          <td   onclick='alert("行数:"+(this.parentNode.rowIndex+1)+"\n列数:"+(this.cellIndex+1))'>点我1</td>          <td   onclick='alert("行数:"+(this.parentNode.rowIndex+1)+"\n列数:"+(this.cellIndex+1))'><table   border=1>              <tr>                <td   onclick='alert("行数:"+(this.parentNode.rowIndex+1)+"\n列数:"+(this.cellIndex+1))'>点我5</td>                <td   onclick='alert("行数:"+(this.parentNode.rowIndex+1)+"\n列数:"+(this.cellIndex+1))'>点我5</td>                <td   onclick='alert("行数:"+(this.parentNode.rowIndex+1)+"\n列数:"+(this.cellIndex+1))'>点我5</td>              </tr>              <tr>                <td   onclick='alert("行数:"+(this.parentNode.rowIndex+1)+"\n列数:"+(this.cellIndex+1))'>点我5</td>                <td   onclick='alert("行数:"+(this.parentNode.rowIndex+1)+"\n列数:"+(this.cellIndex+1))'>点我5</td>                <td   onclick='alert("行数:"+(this.parentNode.rowIndex+1)+"\n列数:"+(this.cellIndex+1))'>点我5</td>              </tr>              <tr>                <td   onclick='alert("行数:"+(this.parentNode.rowIndex+1)+"\n列数:"+(this.cellIndex+1))'>点我5</td>                <td   onclick='alert("行数:"+(this.parentNode.rowIndex+1)+"\n列数:"+(this.cellIndex+1))'>点我5</td>                <td   onclick='alert("行数:"+(this.parentNode.rowIndex+1)+"\n列数:"+(this.cellIndex+1))'>点我5</td>              </tr>            </table></td>        </tr>      </table></td>  </tr></table>

?

读书人网 >Web前端

热点推荐