This article describes the usage of the document object anchors collection in html's DOM. Share it for your reference. The specific analysis is as follows:
The anchors collection returns references to all Anchor objects in the document.
grammar:
Copy the code as follows: document.anchors[]
example:
Copy the code as follows: <html>
<body>
<a name="first">First anchor</a><br />
<a name="second">Second anchor</a><br />
<a name="third">Third anchor</a><br />
<br />
Number of anchors in this document:
<script type="text/javascript">
document.write(document.anchors.length)
</script>
</body>
</html>
I hope this article will be helpful to everyone's JavaScript programming.