<html>
<body>
<h1>HTMLCollection 对象</h1>
<p>循环遍历此页面上的每个 HTML 元素,并输出其标记名称:</p>
<script>
var x, i, l;
x = document.getElementsByTagName("*");
l = x.length;
for (i = 0; i < l; i++) {
document.write(x[i].tagName + "<br>");
}
</script>
</body>
</html>