[thelist] More JavaScript Image Replacement Fun

danielEthan daniel at ionize.net
Thu Mar 13 14:05:03 CST 2003


Hi again,

You may remember me trying to figure out some javascript about 5 days 
ago. The problem was that it wasn't working in Mozilla. Well, I at some 
point ended up with it pretty much working as hoped, except for the 
first time in Mozilla browsers-- and at all on Netscape 4. Well, in my 
stupidity, I wasn't preloading the images, which is why it wasn't 
working on Mozilla. Now everything seems to be working as hoped on ie5+ 
and Moz on both sides.

With Tom's good advice, I started playing with it in Netscape. My error 
was a lack of properties for a layer when I clicked on it. Doing some 
research, I found this was a bug that required a position of relative 
or absolute to be placed on the layer, so that in NN4's world, the 
layer was instantiated.  Simply placing a {position:relative;} on the 
layers fixed it in NN4. However, now I'm throwing the error on the 
images-- that it has no properties (sounding familiar).

I'm not sure if this problem is related to the same bug in NN4, or if 
there's something bad in my code. I tried setting the images position 
to relative, but it didn't work. Perhaps because of unsupported css? 
(#nav img). The error is thrown on objImg, a variable used to shorten 
document.images[i] for subsequent use.

In all honesty, I would be happy to obscure this script entirely from 
NN4. Is the best way to do this just call a function that uses 
Javascript 1.x and write the onmouseover and onmouseout events? Or can 
I get this to work in NN4? I just don't want to throw errors in any 
browser.

Here's the Page:
http://www.ionize.net/CHC2003/temp.html

And here's the Javascript:
http://www.ionize.net/CHC2003/javascripts/functions.js

Thanks,
daniel



More information about the thelist mailing list