运行 ❯
获取您
自己
的网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 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>