<table border="1px" id="myTable" cols="3">
<tr onclick="function1(this)">
<td id="td1" >Cell 1</td>
<td id="td2" >Cell 2</td>
<td id="td3" >Cell 3</td>
</tr>
<tr onclick="function1(this)">
<td id="td1" >Cell 1</td>
<td id="td2" >Cell 2</td>
<td id="td3" >Cell 3</td>
</tr>
<tr onclick="function1(this)">
<td id="td1" >Cell 1</td>
<td id="td2" >Cell 2</td>
<td id="td3" >Cell 3</td>
</tr>
<tr onclick="function1(this)">
<td id="td1" >Cell 1</td>
<td id="td2" >Cell 2</td>
<td id="td3" >Cell 3</td>
</tr>
</table>
<script language="JavaScript">
function function1(elem) {
alert("Cell Index :"+ elem.rowIndex);
}
</script>
我想要使用Javascript其實我創造出具有在TR結束一個編輯功能表中的TR特異性指標TD值TR特異性指標TD值當我點擊編輯按鈕在特定的tr的td轉換爲文本框並編輯表格。我想從使用Javascript
'elem.cells [1] .textContent' –
...並擺脫那些重複的標識。他們應該是獨一無二的。 –