202226701008 4 luni în urmă
părinte
comite
b6b538dd19
1 a modificat fișierele cu 23 adăugiri și 6 ștergeri
  1. 23 6
      add.js

+ 23 - 6
add.js

@@ -1,6 +1,23 @@
-let x = 1;
-let y = 2;
-let z = x+y
-console.log(x)
-console.log(y)
-console.log(z)
+
+
+<html>
+
+<body>
+
+  <script>
+    // 创建一个h1元素
+    var h1Element = document.createElement("h1");
+
+    // 设置h1元素的文本内容
+    h1Element.textContent = "火元素";
+
+    // 设置h1元素的颜色为红色
+    h1Element.style.color = "red";
+
+    // 将h1元素添加到body元素中(你也可以选择添加到其他合适的父元素里)
+    document.body.appendChild(h1Element);
+  </script>
+
+</body>
+
+</html>