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


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com







    Post your comments , suggestion , error , requirements etc here




    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer