Replace all links on the page. JavaScript example open

Replace all links on the page. JavaScript example

Approved. Code works!
This is exactly the working code that is verified by the moderator or site administrators

Get all the strings on the page:

<a href="article1.html">Link1</a>
<a href="article2.html">Link2</a>
<a href="article3.html">Link3</a>

<script>
    var links = document.links;

    for (var i = 0; i < links.length; i++) {

        document.write("<br/>" + links[i].innerText);
        document.write("<br/>" + links[i].href);
    }
</script>
0

More

Leave a Reply

Your email address will not be published. Required fields are marked *

How many?: 22 + 22

lil-code© | 2022 - 2024
Go Top
Authorization
*
*
Registration
*
*
*
*
Password generation