Canman2005 Posted May 4, 2009 Share Posted May 4, 2009 Hi all I have a page with an iframe on it, the iframe is called "myiframe" What I want to do is add a javascript into my parent page so that when the page loads, it opens up the page "inside_the_iframe.html" inside the iframe Can anyone help? Tried tons of scripts but none seem to work, ideally I want to do it with something like <script>document.location='inside_the_iframe.html'; </script> Can anyone help? Thanks Dave Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 4, 2009 Share Posted May 4, 2009 Iframes have a src attribute. <iframe src='inside_the_frame.html'></iframe> Quote Link to comment Share on other sites More sharing options...
Canman2005 Posted May 4, 2009 Author Share Posted May 4, 2009 Sure, but I need to be able to load a page into a iframe with a javascript, only because it's being mixed with a bit of PHP Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 4, 2009 Share Posted May 4, 2009 Give the iFrame an ID attribute. <script type="text/javascript"> document.getElementById("iFrame_ID").src = "inside_the_frame.html"; </script> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.