现在TD是HTMLTableCellElement,TD.outerHtml = <td class="current highlight">C2</td>
我要往td里添加一个div
<td class="current highlight">C2
<div id="remmem">
This is a newcon
</div>
</td>
一:
var newNode = document.createElement("div");
newNode.id = "remmem";
newNode.innerHTML =" This is a newcon ";
newNode.style.color = "red";
二:
TD.appendChild(newNode);
效果:<td class="current highlight">C3<div id="remmem">This is a newcon </div></td>
时间: 2024-11-08 03:36:51