Thank you so much sir!
Yes, apparently browser holds an old iframe's content while reloading until onload event occurs.
But will setting timeout solve the problem, actually?
It appears that 'onload' event must be more correct because it patently tells browser to check if a proper document really loaded, and if true --> perform requested action, else --> still wait.
In case of timeout browser simply looks at what is placed in the iframe after pointed time, and then goes work, no matter was the timeout enough to load the next document.
So if there's a poor dial-up modem connection, poor line etc., a user, it seems, must receive an old page again -- a brouser will give what it keeps loaded.
Maybe I'm wrong, I'm just a newbie in JS. I was trying to use 'onload' but it doesn't work whatever I performed to fire it.
There's a sample code from here down:
_________________________________
<html><head><title>iframe-to-div sample</title>
<style type="text/css"><!--
body{overflow:hidden}
.rootDiv{border:1px solid slategray; cursor:hand; font-weight:bold; font-size:14px; letter-spacing:1px; font-family:Verdana;}
.nest{position:absolute; margin-top:34px; left:23px; overflow:auto; width:123px; height:123px;}
--></style>
<script language="JavaScript1.2" type="text/javascript"><!-- //
//urls array..
URLs = [null, 'url_1.html', 'url_2.html', 'url_3.html', 'url_4.html', 'url_5.html'];
//text for buttons
txt=[null, "url_1", "url_2", "url_3", "url_4", "url_5"];
//take iframe's innerHTML and place it into DIV
function iframeToDiv()
{
screenDIV.innerHTML = ifr.document.body.innerHTML;
}
//load a proper url into iframe;
//then call the iframeToDiv() function when _onload_
function loadURL( theURL )
{
ifr.location.href = theURL;
ifr.document.onload = iframeToDiv();
}
//write menus with 'onclick' event..
function doStuff()
{
for(i=1; i<=5; i++)
{
document.write('<div class="rootDiv" id="'+i+'" onclick="loadURL(URLs[' + i + '])">'+txt[i]+ '</div><br />');
}
}
doStuff();
// --></script>
</head>
<body>
<!-- the hidden iframe where we load files for retreiving their innerHTML property -->
<iframe name="ifr" id="nestFRAME" class="nest"></iframe>
<!-- our brave div to take the innerHTML of documents _loaded_ into iframe -->
<div class="nest" id="screenDIV" style="left:180px; border:1px solid black"> </div>
</body></html>
_________________________________
And a little addition -- the sample files sources, please:
______________________
<!-- url_1.html -->
<html>
<head>
<title>url_1</title>
</head>
<body>
<p>
url_1
</p>
</body>
</html>
______________________
<!-- url_2.html -->
<html>
<head>
<title>url_2</title>
</head>
<body>
<p>
url_2
</p>
</body>
</html>
______________________
<!-- url_3.html -->
<html>
<head>
<title>url_3</title>
</head>
<body>
<p>
url_3
</p>
</body>
</html>
______________________
<!-- url_4.html -->
<html>
<head>
<title>url_4</title>
</head>
<body>
<p>
url_4
</p>
</body>
</html>
______________________
<!-- url_5.html -->
<html>
<head>
<title>url_5</title>
</head>
<body>
<p>
url_5
</p>
</body>
</html>
______________________
THANK YOU AGAIN, MR J!
Best regards --
>> Endeavor
p.s. Sorry for such overflood here!..