Iframe Link

by Rapha Souza

HTML

<script src="//code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<link rel="stylesheet" href="//stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js"></script>
<script src="//stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<!DOCTYPE html>
<html>
<body>

<a id="y">A Link: Go to w3schools.com</a>

<iframe name="InlineFrame1" id="myAnchor" width="100%" height="1000px"  frameborder="1" ></iframe>


<p>Click the button to set the href attribute with a value of "www.w3schools.com" of the a element above.</p>

<button onclick="myFunction()">Try it</button>
<button onclick="myFunction2()">Try it</button>
<p><strong>Note:</strong> Internet Explorer 8 and earlier does not support the setAttribute method.</p>

<script>
function myFunction() {
    document.getElementById("myAnchor").setAttribute("src", "https://www.w3schools.com"); 
}

function myFunction2() {
    document.getElementById("myAnchor").setAttribute("src", "https://www.google.com"); 
}
</script>

</body>
</html>