[Javascript] Swapping an Image

Steve White steve at VirtualMechanics.com
Thu Jul 19 23:32:16 CDT 2001


I just checked and one of the reasons I added the width and height unit
identifier is so that we can sometimes set Percentage width and height
values. I have posted an example at:
http://www.virtualmechanics.com/test/relsize.html If you resize the screen
the graphics and text will maintain their relative dimensions. (at least in
IE and NN6. I thought I had it working in NN4.x but one of my other changes
must have broken it). So what is the official and/or reliable way to do
this?

Thanks.

-----Original Message-----
From: javascript-admin at LaTech.edu [mailto:javascript-admin at LaTech.edu]On
Behalf Of Ben Curtis
Sent: Thursday, July 19, 2001 8:22 PM
To: javascript at latech.edu
Subject: Re: [Javascript] Swapping an Image



>> 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."







_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
http://www.LaTech.edu/mailman/listinfo/javascript




More information about the Javascript mailing list