JavaScript returns the method of anchor points in a web page

  • 2020-05-26 07:42:42
  • OfStack

This example demonstrates how JavaScript returns the number of anchor points in a web page. Share with you for your reference. The details are as follows:

JavaScript returns the number of anchors in the page, and the JS code below gets the number of anchor in the page


<!DOCTYPE html>
<html>
<body>
<a name="html">HTML Tutorial</a><br>
<a name="css">CSS Tutorial</a><br>
<a name="xml">XML Tutorial</a><br>
<a href="https://www.ofstack.com/">JavaScript code </a>
<p>Number of anchors:
<script>
document.write(document.anchors.length);
</script></p>
</body>
</html>

I hope this article has been helpful to your javascript programming.


Related articles: