0
我試圖打印頁面表中每一行的rowIndex。我想它被放置在表本身裏面,但我似乎無法得到它的工作:頁面加載時返回行的rowIndex
<table>
<tr>
<td>r1.cell1</td>
<td>r1.cell2</td>
<td><script>document.write("rowindex = " + this.parentNode.rowIndex);</script></td>
</tr>
<tr>
<td>r2.cell1</td>
<td>r2.cell2</td>
<td><script>document.write("rowindex = " + this.parentNode.rowIndex);</script></td>
</tr>
</table>
這在你的腳本的執行的情況下指的是窗口對象看到它的行動,而不是節點。你的解決方案必須是純JS還是可以使用jQuery等庫? – Louis
Louis,可以使用jQuery – oewebby