当前位置: 代码迷 >> Web前端 >> 支持IE跟Firefox的得到表格的当前行号和列号
  详细解决方案

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

热度:34   发布时间:2012-11-06 14:07:00.0
支持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>

?