cyfer65 Posted November 3, 2009 Report 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 Report 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 Report 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 Report 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
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now