<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>
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter