執行 ❯
建立您
自己的
網站
×
更改方向
儲存程式碼
更改主題,深色/淺色
轉到 Spaces
<!DOCTYPE html> <html> <body> <p>Click the button to create a FIGURE element containing an IMG element.</p> <button onclick="myFunction()">Try it</button><br><br> <script> function myFunction() { var x = document.createElement("FIGURE"); x.setAttribute("id", "myFigure"); document.body.appendChild(x); var y = document.createElement("IMG"); y.setAttribute("src", "img_pulpit.jpg"); y.setAttribute("width", "304"); y.setAttribute("width", "228"); y.setAttribute("alt", "The Pulpit Rock"); x.appendChild(y); } </script> </body> </html>