0
我想在下面的tbody
但在第一行("aaaaa"
)之後創建一個新行。如何通過跳過表中的第一行來創建動態行
<html>
<body onload="generate()">
<table id="myTable">
<thead>
<tr>
<th>My Header</th>
</tr>
</thead>
<tbody id="myList">
<tr>
<td>aaaaa</td>
</tr>
</tbody>
</table>
</body>
<script>
function generate(){
var node = document.createElement("tr");
node.setAttribute("id","one");
var textnodeTD = document.createElement("td");
var values = document.createTextNode("AAAAA");
document.getElementById("myList").lastChild(node);
document.getElementById("one").appendChild(textnodeTD);
textnodeTD.appendChild(values);
}
</script>
</html>
謝謝我知道了.. – Sathish