编辑下面的代码:【加编码】
<html> <body> <p>Hello World!</p> <div id="main"> <p>The DOM is very useful.</p> <p>This example demonstrates the <b>getElementsByTagName</b> method</p> </div> <script> x=document.getElementById("main").getElementsByTagName("p"); document.write("First paragraph inside the div: " + x[0].innerHTML); </script> </body></html>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂