cyfer65 Posted November 3, 2009 Share Posted November 3, 2009 how would I Execute some JavaScript code only After and IFrame has 100% loaded on a webpage..?? Link to comment Share on other sites More sharing options...
jeffman Posted November 3, 2009 Share Posted November 3, 2009 Your iFrame has a load listener. myIframe.onload = function() { go();}; If by completely, you mean images as well, then that's a different and more complicated matter. Link to comment Share on other sites More sharing options...
cyfer65 Posted November 3, 2009 Author Share Posted November 3, 2009 well what does the code you posted do then..??could you give me an example of how to use this please..!! Link to comment Share on other sites More sharing options...
jeffman Posted November 3, 2009 Share Posted November 3, 2009 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html> <head> <meta http-equiv="content-type" content="text/html;charset=UTF-8"> <title></title> <script type="text/javascript"> function init () { document.getElementById("myframe").onload = function () { alert ("somewhere.html is completely loaded"); } } window.onload = init; </script> </head> <body> <div>Something</div> <iframe src="somewhere.html" id="myframe"></iframe> </body></html> It is important to set the onload handler after the main window has loaded. If we tried to do it while the page was loading, the script would not find the iframe, because that part of the document wouldn't have been read yet. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.