运行 ❯
获取您
自己
的网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <body> <p>Click the button to create a FIGCAPTION element with some text.</p> <button onclick="myFunction()">Try it</button><br><br> <figure id="myFigure"> <img src="/tags/img_pulpit.jpg" alt="The Pulpit Rock" width="304" height="228"> </figure> <script> function myFunction() { var x = document.createElement("FIGCAPTION"); var t = document.createTextNode("Fig.1 - A view of the pulpit rock in Norway."); x.appendChild(t); var y = document.getElementById("myFigure"); y.appendChild(x); } </script> </body> </html>