[Javascript] Swapping an Image

Ben Curtis Quixote at LaMancha.org
Thu Jul 19 19:22:17 CDT 2001


>> I used to be able to swap an image in NN4.x but after some changes to add
>> support for NN6 it no longer works and I am not sure why.
>> 
>> The original image is declared:
>> 
>> <img id="GGeo4" Align=Top SRC="bird-1.gif" border=0 width="161px"
>> height="121px">

Keep in mind that attribute values for non-event handler or style attributes
are themselves HTML, and not CSS or Javascript. You don't need to put "px"
in your height and width assignments, since these attributes only accept
pixel values. This shouldn't be your problem for the browsers you mention --
other browsers may choke on it though.


> You use ID to give the image a name, NN4 doesn't recognize this. Use NAME
> instead. I think it's also supported in the other browsers.

Yes, good advice. W3C recommends using both for the time being, even though
it looks weird:

<img id="GGeo4" name="GGeo4" src="bird-1.gif" align="Top" border="0"
width="161" height="121">

--
+Ben Curtis

"You must be the change you wish to see in the world."










More information about the Javascript mailing list