Re: Referencing Images with JavaScript in HTML4
by Andrew McFarland <aamcf(at)aamcf.co.uk>
|
Date: |
Wed, 15 May 2002 16:04:27 +0100 |
To: |
<hwg-basics(at)hwg.org> |
In-Reply-To: |
nrc |
|
todo: View
Thread,
Original
|
|
At 10:06 15/05/2002 -0400, Martin Clifford wrote:
>Do we have to use ID tags now? document.images['mrHappy'].src =
>'images/mrHappy.gif';?
Yes - although referencing an image by ID doesn't work with Netscape 4.
IMO, the `best' way to do it (if you don't have to worry about NS4) is as
follows:
if (document.getElementById && document.getElementById('foo')) {
document.getElementById('foo').src = bar
}
Andrew
HTML: hwg-basics mailing list archives,
maintained by Webmasters @ IWA