我怎樣才能在下面的代碼中添加一個新列, 我需要這種情況發生,如果沒有表ID或TR ID或TD ID。添加新的列到HTML表中沒有表ID
請檢查並告訴我
<p>Click the button to insert new cell(s) at the beginning of the table row.</p>
<table>
<tr>
<td>First cell</td>
<td>Second cell</td>
<td>Third cell</td>
</tr>
</table><br>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction() {
var row = ??????????????
var x = row.insertCell(0);
x.innerHTML = "New cell";
}
</script>
所以你只想得到任何表的引用沒有ID,或沒有ID任何TR,或沒有ID的TD?在那個例子中,這將是該表中的每一個元素 - 是嗎? – Whothehellisthat