运行 ❯
获取您
自己
的网站
×
更改方向
保存代码
更改主题,深色/浅色
转到 Spaces
<!DOCTYPE html> <html> <body> <div id="myDIV"> <p id="demo">This is a p element with id="demo" in a div.</p> </div> <p>Click the button to change the text of the p element in div.</p> <button onclick="myFunction()">Try it</button> <script> function myFunction() { var x = document.getElementById("myDIV"); x.querySelector("#demo").innerHTML = "Hello World!"; } </script> </body> </html>