W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<!DOCTYPE html> <html> <body> <h1>JavaScript HTML DOM</h1> <p>Hello World!</p> <p>Hello China!</p> <p id="demo"></p> <script> var myCollection = document.getElementsByTagName("p"); document.getElementById("demo").innerHTML = "此文档包含 " + myCollection.length + " 段文字。"; </script> </body> </html>