1. 创建一个新的节点: document.createElement()

2. 插入新创建出来的节点: Node.prototype.appendChild()

var p = document.createElement("p");
p.innerText = "helloWorld";
document.body.appendChild(p);

 

相关文章:

  • 2022-12-23
  • 2022-01-01
  • 2021-10-07
  • 2022-12-23
  • 2022-12-23
  • 2022-02-16
  • 2021-10-08
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-13
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案