I am in the process of creating a website and I need a little help. I have two iframes on the main Page of my website (index.php) and I load within the main iframe a variety of different pages which are assessable through links, each of these have their own special sections which load independently. How can I make it so when the page loads it tells the second iframe to load a specific page without the need for the user to have to click a link to force the page into the iframe?
Many thanks!Force iframe content to change on page load? Please help!?You can add a client side Javascript method attached to the onload event of the page/form. Something like:
%26lt;script type='text/javascript' language='javascript'%26gt;
function LoadIFrame() {
var frm = document.getElementById( 'frm' );
if( frm != null ) {
frm.src = 'http://www.url.com';
}
}
%26lt;/script%26gt;
...
%26lt;body onload='LoadIFrame();' %26gt;
...
%26lt;iframe id='frm' /%26gt;
....Force iframe content to change on page load? Please help!?Why can't you just set the src property of the iframe so that it loads an initial default page?