Hi!
I have modified a script I found on the Internet to the following one. Its purpose is to show an iframe tag 4 seconds after the html page has finished loading. However, the iframe tag always cover up all other materials when it loads. What is the problem with my script? Can anybody help me? By the way, can anybody see if there are any useless step in the script?
<script language="JavaScript">
<!--
timeFlag = 0;
blurFlag = 0;
popWinFlag = 0;
window.name="mainWin";
function initFocus() {
self.focus();
}
function waitForFocus() {
blurFlag=1;
}
function resetBlurFlag() {
blurFlag=0;
checkFlags();
}
function checkFlags() {
if (blurFlag == 0 && timeFlag == 1) {
createWin();
} else {
if (timeFlag == 1) {
waitForFocus();
}
}
}
function createWin() {
if (popWinFlag == 0) {
document.write('<iframe width="500" height="400"
frameborder="0" scrolling="no" marginheight="0px"
marginwidth="0px" src="http://www.yahoo.com"></iframe>');
popWinFlag = 1;
}
}
window.onload = initFocus;
window.setTimeout("timeFlag=1; checkFlags();",4000);
window.onblur = waitForFocus;
window.onfocus = resetBlurFlag;
// -->
</script>
Thanks a lot!
I have modified a script I found on the Internet to the following one. Its purpose is to show an iframe tag 4 seconds after the html page has finished loading. However, the iframe tag always cover up all other materials when it loads. What is the problem with my script? Can anybody help me? By the way, can anybody see if there are any useless step in the script?
<script language="JavaScript">
<!--
timeFlag = 0;
blurFlag = 0;
popWinFlag = 0;
window.name="mainWin";
function initFocus() {
self.focus();
}
function waitForFocus() {
blurFlag=1;
}
function resetBlurFlag() {
blurFlag=0;
checkFlags();
}
function checkFlags() {
if (blurFlag == 0 && timeFlag == 1) {
createWin();
} else {
if (timeFlag == 1) {
waitForFocus();
}
}
}
function createWin() {
if (popWinFlag == 0) {
document.write('<iframe width="500" height="400"
frameborder="0" scrolling="no" marginheight="0px"
marginwidth="0px" src="http://www.yahoo.com"></iframe>');
popWinFlag = 1;
}
}
window.onload = initFocus;
window.setTimeout("timeFlag=1; checkFlags();",4000);
window.onblur = waitForFocus;
window.onfocus = resetBlurFlag;
// -->
</script>
Thanks a lot!