JS dynamically modifies the way iframe inlays web addresses

  • 2020-05-26 07:37:00
  • OfStack

This example demonstrates how JS dynamically modifies the iframe inline web address. Share with you for your reference. The specific analysis is as follows:

The JS code below dynamically modifies the embedded iframe web page by modifying the src property of iframe


<!DOCTYPE html>
<html>
<head>
<script>
function changeSrc()
{
document.getElementById("myframe").src="http://google.com";
}
</script>
</head>
<body>
<iframe id="myframe" src="/default.asp">
<p>Your browser does not support iframes.</p>
</iframe>
<br><br>
<input type="button" onclick="changeSrc()" value="Change Source">
</body>
</html>

I hope this article is helpful for you to design javascript program.


Related articles: