Using A Javascript Function To Load A Page In An IFrame August 08, 2022 Post a Comment I'm trying to use a Javascript function to load a web page in an iframe named 'cake'. How can I do that? Solution 1: function changeUrl() { var site = "https://www.google.com/"; document.getElementsByName('iFrameName')[0].src = site; }Copy <html> <head> </head> <body> <button onclick="changeUrl()">Load page in iframe</button> <iframe name="iFrameName"></iframe> </body> </html>Copy Solution 2: This worked: Baca JugaValidate And Filter Email Address With Regex?How Do Javascript Engine Count Number Of Tag Of The Html Document Is Ill-formed?How To Pass Data To C3 Graph <html> <head> <script type="text/javascript"> function changeUrl() { var site = "1.wav"; document.getElementsByName('cake')[0].src = site; } </script> </head> <body> <center> <iframe src="http://www.w3schools.com" height=400 width=400 frameborder=0 name = "cake" style =""></></iframe> <br> <br> <button onclick="changeUrl()">Load page in iframe</button> </center> </body> </html>Copy Share You may like these postsUnsafe Javascript Attempt To Access Frame In Google ChromeIframe Auto Size Based On Content That Changes Size Based On Search ResultsDynamically Change Iframe's ContentIframe Reload Button Post a Comment for "Using A Javascript Function To Load A Page In An IFrame"
Post a Comment for "Using A Javascript Function To Load A Page In An IFrame"