支持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>

 

你可能感兴趣的:(IE,firefox)