執行 ❯
建立您
自己的
網站
×
更改方向
儲存程式碼
更改主題,深色/淺色
前往 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>