帮我分析一下原因
一个html文件中内容如下:
<script language="javascript">
document.write("anchors长度:");
document.write(document.anchors.length);
document.write("所有长度:");
document.write(document.all.length);
</script>
<form>
<body>
<a href="#mark1" name=href1 id="p1">to p1</a><br>
<a href="#mark2" name=href2 id="p2">to p1</a><br>
<a name="mark1" id="p3">paragraph1<br>
<a name="mark2" id="p4">paragraph2<br>
</body>
</form>
我运行时显示:
anchors长度:0所有长度:5
to p1
to p1
paragraph1
paragraph2
为什么anchors的长度为0,所有的长度为5?