如果您想在中添加行
tbody,请获取对其的引用,然后在其中添加。
var tableRef = document.getElementById('myTable').getElementsByTagName('tbody')[0];// Insert a row in the table at the last rowvar newRow = tableRef.insertRow();// Insert a cell in the row at index 0var newCell = newRow.insertCell(0);// Append a text node to the cellvar newText = document.createTextNode('New row');newCell.appendChild(newText);工作演示在这里。另外,您可以在
insertRow此处查看文档。



