Home > Web Front-end > JS Tutorial > JavaScript method to return the number of anchors in a web page_javascript skills

JavaScript method to return the number of anchors in a web page_javascript skills

WBOY
Release: 2016-05-16 16:05:40
Original
1038 people have browsed it

The example in this article describes how JavaScript returns the number of anchor points in a web page. Share it with everyone for your reference. The details are as follows:

JavaScript returns the number of anchors in the web page. The following JS code gets the number of anchors 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="http://www.jb51.net/">JavaScript代码</a>
<p>Number of anchors:
<script>
document.write(document.anchors.length);
</script></p>
</body>
</html>
Copy after login

I hope this article will be helpful to everyone’s JavaScript programming design.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template