Edit The Code:
See Result »
Try it Yourself - ©
w3big.com
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>本教程(w3big.com)</title> </head> <body> <p>这是一个 p 与元素。</p> <p>这也是一个 p 与元素。</p> <p>点击按钮修改文档中第一个 p 元素的背景颜色。</p> <button onclick="myFunction()">点我</button> <script> function myFunction() { document.querySelector("p").style.backgroundColor = "red"; } </script> </body> </html>