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