[thelist] javascript image replace broken in gecko

danielEthan daniel at ionize.net
Fri Mar 7 12:43:01 CST 2003

>> 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:
> Now I'm more into this:
> document.getElementById(objImg).setAttribute("src","./images/
> navigation/expand.gif");
> which is a bit more trendy, I guess ;-)
> (and works all right in Mozilla)

Thanks for the help Stef. Wouldn't this solution only work in browsers
that support getElementById? I'm not sure what those encompass
(definitely not 4.0, iirc) but would be a concern for this project.

More information about the thelist mailing list