I was in a rush when I first replied. Here is a more detailed explanation. Put this in the head of your index page, the one containing the iframe:
Code:
<script type="text/javascript">
/*Load iframe from Query script
*As first seen in http://www.dynamicdrive.com/forums
*This notice must remain for legal use */
function loadframe(){
if(window.location.replace)
window.frames.daFrame.location.replace(get('framepage'));
else
window.frames.daFrame.location.href=get('framepage');
}
function get(key_str) {
var query = window.location.search.substr(1);
var pairs = query.split("&");
for(var i = 0; i < pairs.length; i++) {
var pair = pairs[i].split("=");
if(unescape(pair[0]) == key_str)
return unescape(pair[1]);
}
return null;
}
if (location.search&&get('framepage')!=null)
if ( typeof window.addEventListener != "undefined" )
window.addEventListener( "load", loadframe, false );
else if ( typeof window.attachEvent != "undefined" )
window.attachEvent( "onload", loadframe );
else {
if ( window.onload != null ) {
var oldOnload = window.onload;
window.onload = function ( e ) {
oldOnload( e );
loadframe();
};
}
else
window.onload = loadframe;
}
</script>
Notice the two red daFrame's. Substitute the name of your iframe for both of them.
Use a script like so in the head of the page that you want contained in the iframe:
Code:
<script type="text/javascript">
function load_content (page) {
if (window.location==top.location)
if (window.location.replace)
top.location.replace(page+'?framepage='+top.location.href);
else
top.location.href=page+'?framepage='+top.location.href;
}
</script>
And, in its body tag:
HTML Code:
<body onload="load_content('index.html');">
Bookmarks