Hi I have the following html file with 3 Javascript functions:
I want to find a way to have function setFrame() call callPage(). Then have callPage() finish loading the iframe
then call finishedLoading(). And once finishedLoading() is complete function setFrame() will continue.
The problem is setFrame() continues on before finishedLoading() is complete.
<html>
<head>
<title>Test</title>
<script language="Javascript">
function setFrame(){
alert("here");
callPage();
alert("end");
}
function callPage(){
var myIframe = document.getElementById("iframe");
if (document.all) {
myIframe.onreadystatechange=function() {
if (myIframe.readyState=="complete" || myIframe.readyState=="loaded") {
finishedLoading();
}
};
}
else {
myIframe.onload=finishedLoading;
}
myIframe.src=" }
function finishedLoading() {
alert("myIframe loaded");
}
</script>
</head>
<body onload="setFrame();" id="body" bgcolor="red">
<iframe height="500" width="500" id="iframe" name="iframe" >
</iframe>
</body>
</html>
I want to find a way to have function setFrame() call callPage(). Then have callPage() finish loading the iframe
then call finishedLoading(). And once finishedLoading() is complete function setFrame() will continue.
The problem is setFrame() continues on before finishedLoading() is complete.
<html>
<head>
<title>Test</title>
<script language="Javascript">
function setFrame(){
alert("here");
callPage();
alert("end");
}
function callPage(){
var myIframe = document.getElementById("iframe");
if (document.all) {
myIframe.onreadystatechange=function() {
if (myIframe.readyState=="complete" || myIframe.readyState=="loaded") {
finishedLoading();
}
};
}
else {
myIframe.onload=finishedLoading;
}
myIframe.src=" }
function finishedLoading() {
alert("myIframe loaded");
}
</script>
</head>
<body onload="setFrame();" id="body" bgcolor="red">
<iframe height="500" width="500" id="iframe" name="iframe" >
</iframe>
</body>
</html>