[Javascript] Can I tell when an animated Gif is finished?

spacific at paradise.net.nz spacific at paradise.net.nz
Sun Dec 30 05:16:20 CST 2001


Hi,

I need to display an animated gif (non-looping), wait for it to finish and then go to another page.  At present I have tried a crude time delay after switching on the gif:

    document[theImage].src = MyAnimGif.src;
    get the time...
    wait until time advanced so many seconds...

This works in some browsers but not others, where the switched-on gif obviously gets flagged as pending but doesn't actually play until the delay is over (presumably in idle time). Sorry, cannot remember which is IE and which N.

Is there something like an onCompletion event I could attach to the image? (Cannot find anything in a list of events I have.)  Or perhaps a way of forcing the gif to display immediately to completion, or to begin displaying immediately? Or some other way of detecting when the animation is done?

Thanks for any help.

John





More information about the Javascript mailing list