document.links: Links in a web page
Here is the syntax to get numbr of links in a webpage.
document.write(document.links.length);
Here is an example
<script type="text/javascript">
document.write(document.links.length);
</script>
The output is here
The first link is here
document.write(document.links[0]);
docment.links[] is an array so we can display all its elements like this.
for (i=0;i<document.links.length;i++)
{
document.write(document.links[i] + "<br >");
}
Output is here
← document Object URL of the page →
← Subscribe to our YouTube Channel here
This article is written by plus2net.com team.
plus2net.com