代码示例:(标识:jsck_doc_scripts_1)
<!DOCTYPE html>
<html>
<body>
<h1>Document 对象</h1>

<h2>scripts 属性</h2>

<script>
document.write("Hello World!");
</script>

<p>文档中脚本元素的数量:</p>

<p id="demo"></p>

<script>
document.getElementById("demo").innerHTML = document.scripts.length;
</script>

</body>
</html>
运行结果: