Script executing chronology messup

I’ve got a bit problem with executing scripts on objects that are yet to be loaded.

I have a website that has a flash player in it. Now, that player has several keyframes in it and each contains different videos.

In the page I have an onLoad function that looks like this:

<body onLoad="javascript:window.document.player.GotoFrame(7);

…and so on. Afterwards the flash object is loaded.

Now, when I open the page for the first time from an outside link the player gets stuck on the first frame. When I refresh the page - sometimes takes several tries - then the player skips to the desired frame.

Is there any way to avoid this and make sure that when he user opens the page he will see what he’s supposed to?

Try placing the script at the end of the body instead.

<script type="text/javascript">

Thanks for the reply.
I placed the script at the end but it didn’t work. I’ve also noticed that it actually does work but only under IE, Firefox makes still the same thing.

That’s good to confirm. It appears that you have a technique for controlling the flash player that works only on IE.

Indeed, I did some search on the net and it seems that Firefox handles onLoad differently. Also, I’ve noticed that if I open a page for the first time it gets ignored. Then if I refresh the page the script kicks in. Now I’m wondering how to make sure that Firefox won’t ignore it the first time.

Any ideas?