[thelist] javascript image replace broken in gecko

DESCHAMPS Stéphane DvSI/SICoR stephane.deschamps at francetelecom.com
Fri Mar 7 12:28:01 CST 2003

> -----Message d'origine-----
> De : thelist-admin at lists.evolt.org
> [mailto:thelist-admin at lists.evolt.org]De la part de danielEthan
> Hi evolters,
> I apologize to any that are seeing this post again. *Another* list
> couldn't answer it. Teach me.
> I have a menu with a widget to turn down. I've two images, one called
> 'expand' and one called 'collapse.' When the function is called from
> the onclick, I want to not only change the display of an element, but
> also change the src of the image. Here's my code:


I've always used an old way of doing this, maybe it will solve your problem:

Out of your toggle you'd define two image objects like so:
expandImg = new Image();
expandImg.src = "./images/navigation/expand.gif";
collapseImg = new Image();
collapseImg.src = "./images/navigation/collapse.gif";

Then you'd write either
objImg.src = expandImg.src
objImg.src = collapseImg.src

... but I can't tell you why I did so in the first place, although it did work.

Now I'm more into this:
which is a bit more trendy, I guess ;-)
(and works all right in Mozilla)

More information about the thelist mailing list