📜  将元素添加到正文 javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:38.677000             🧑  作者: Mango

代码示例2
// In the JS script

var parElement = document.getElementById("myPar");
var textToAdd = document.createTextNode("Text to be added");
parElement.appendChild(textToAdd);

//In the HTML file