html - iframes and links in multiple webpages - Stack Overflow

PHOTO EMBED

Tue Jul 12 2022 20:02:20 GMT+0000 (Coordinated Universal Time)

Saved by @Shookthadev999 #html

<body onload="changeSrc()">
<!-- Load the default page in the iframe, for instance a1.html -->
<iframe id="abc" src="a1.html"></iframe>
<script>
    function changeSrc() {
        var hash = window.location.hash;
        var frame = document.getElementById("abc");

        if(hash == "#a1") {
            frame.src = "a1.html";
        }
        else if(hash == "#a2") {
            frame.src = "a2.html";
        }
        else if(hash == "#a3") {
            frame.src = "a3.html";
        }
        else {
            // default
            frame.src = "a1.html";
        }
    }
</script>
</body>
content_copyCOPY

https://stackoverflow.com/questions/27760939/iframes-and-links-in-multiple-webpages