Welcome to WebmasterWorld Guest from 50.17.16.177

Forum Moderators: incrediBILL

Message Too Old, No Replies

adding setTimeout to doby onload command

     
5:01 pm on Oct 2, 2002 (gmt 0)

New User

10+ Year Member

joined:July 7, 2002
posts:33
votes: 0


Some time ago, with a lot help from webmasterWorld Ōbrain trustÕ, I implemented the following script

<body onload="if (window.opener && !window.opener.closed){window.opener.parent.location='back_cover.html';}"

The script runs in a popup window and it changes the contents in the window that launched the popup. It works great. However, here is my problem. The onload works when all the html is loaded but IÕm loading a flash movie, which onload doesnÕt recognize, this results in the new contents and my flash movie loading at the same time, which slows down the whole process.

IÕve been trying to incorporate ŌsetTimeoutÕ command to delay the loading for 20 seconds but canÕt get it to work.

Any help writing this script much appreciated.

Mak

5:32 pm on Oct 2, 2002 (gmt 0)

Senior Member

WebmasterWorld Senior Member korkus2000 is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 20, 2002
posts:3732
votes: 0


Have you tried:

setTimeout("if (window.opener && !window.opener.closed){window.opener.parent.location='back_cover.html';})", 20000);

You could also use Flash to execute the script when it is done loading using FScommand.

6:17 pm on Oct 2, 2002 (gmt 0)

New User

10+ Year Member

joined:July 7, 2002
posts:33
votes: 0


thanks korkus but it's still not working for me.

I like the FScommand but alas the 'flashmaster' couldn't live up to his name and I can't get that to work either.

6:28 pm on Oct 2, 2002 (gmt 0)

Senior Member

WebmasterWorld Senior Member korkus2000 is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 20, 2002
posts:3732
votes: 0


Have you tried the code in a script tag and not in the onload?

<script>
function waitABit(){
setTimeout("popMe()", 20000);
}

function popMe(){
if (window.opener && !window.opener.closed){window.opener.parent.location='back_cover.html';}
}

</script>

<body onLoad="waitABit()">

With Flash

Have an action on your first frame that check to see if the last frame is loaded. Once it triggers you want to

Get URL ("javascript:popMe()")

1:44 pm on Oct 3, 2002 (gmt 0)

New User

10+ Year Member

joined:July 7, 2002
posts:33
votes: 0


Hi Korkus,

you have made my day, it works a treat.

thank you

Mak