Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q1471 Is it possible for a JavaScript rollover to switch a static image to a GIF-89 animation? I've tried using the regular rollover code, pointing to a GIF-89 as the graphic to load onMouseOver, but I get only the final frame of the animation.

irt.org | Knowledge Base | JavaScript | Image | Q1471 [ previous next ]

Q1471 Is it possible for a JavaScript rollover to switch a static image to a GIF-89 animation? I've tried using the regular rollover code, pointing to a GIF-89 as the graphic to load onMouseOver, but I get only the final frame of the animation.

Probably because you have preloaded it and it is in the cache. Load it like this:

<a href="..." onMouseOver="now = new Date(); document.images['theAnimation'].src = 'theanimated.gif?' + now.getTime();"><img src="static.gif" name="theAnimation"></a>

That way you should get a new version.


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.