執行 ❯
建立您
自己的
網站
×
更改方向
儲存程式碼
更改主題,深色/淺色
前往 Spaces
<!DOCTYPE html> <html> <body> <p>Click the button to create a HEADER element containing a h3 element with some text.</p> <button onclick="myFunction()">Try it</button> <script> function myFunction() { var x = document.createElement("HEADER"); x.setAttribute("id", "myHeader"); document.body.appendChild(x); var y = document.createElement("H3"); var t = document.createTextNode("This is a h3 element in a header element"); y.appendChild(t); document.getElementById("myHeader").appendChild(y); } </script> </body> </html>