x
 
<!DOCTYPE html>
<html>
<body>
<h1>Element 对象</h1>
<h2>children.length 属性</h2>
<p>"myDIV" 有多少子元素?</p>
<p id="demo"></p>
<div id="myDIV">
  <p>我是段落。</p>
  <p>我是段落。</p>
  <p>我是段落。</p>
</div>
<script>
let count = document.getElementById("myDIV").children.length;
document.getElementById("demo").innerHTML = count;
</script>
</body>
</html>