<!DOCTYPE html> <html> <body> <h1>Document 对象</h1> <h2>scripts 属性</h2> <script> document.write("Hello World!"); </script> <p>The第一个 script 元素的内容:</p> <p id="demo"></p> <script> document.getElementById("demo").innerHTML = document.scripts.item(0).text; </script> </body> </html>