请编写一段JavaScript脚本生成下面这段DOM结构。要求:使用标准的DOM方法或属性。

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script>
      var oWrapper = document.createElement("div");
      oWrapper.id = "example";
      var oChild = document.createElement("p");
      oChild.className = "title bigger";
      var textNode = document.createTextNode("标题");
      oChild.append(textNode);
      oWrapper.append(oChild);
      console.log(oWrapper);
    </script>
  </head>
  <body></body>
</html>

Guess you like

Origin blog.csdn.net/liulang68/article/details/121255885