Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

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.

You are here: irt.org | FAQ | JavaScript | Image | Q1471 [ previous next ]

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.

©2018 Martin Webb