W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<!DOCTYPE html> <html> <body> <h3>如何访问 SECTION 元素的演示</h3> <section id="mySection"> <h1>Section Heading</h1> <p>Some text in section..</p> </section> <p>单击按钮将节内容的文本颜色设置为红色。</p> <button onclick="myFunction()">试一试</button> <script> function myFunction() { var x = document.getElementById("mySection"); x.style.color = "red"; } </script> </body> </html>