运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
转到 Spaces
<!DOCTYPE html> <html> <body> <h3>A demonstration of how to access a FIGCAPTION element</h3> <figure> <img src="/tags/img_pulpit.jpg" alt="The Pulpit Rock" width="304" height="228"> <figcaption id="myFigCap">Fig.1 - A view of the pulpit rock in Norway.</figcaption> </figure> <p>Click the button to set the color of the caption to red.</p> <button onclick="myFunction()">Try it</button> <script> function myFunction() { var x = document.getElementById("myFigCap"); x.style.color = "red"; } </script> </body> </html>