x
 
<!DOCTYPE html>
<html>
<body>
<h1>HTMLCollection 对象</h1>
<p>使用 getElementsByTagName() 方法来返回 HTMLCollection。</p>
<p>此页面上 P 元素的数量:</p>
<script>
var x = document.getElementsByTagName("P");
document.write(x.length);
</script>
</body>
</html>