80********@videotron.ca said the following on 9/4/2006 9:33 PM:
Hi.
Please take a look at this page:
http://tinyurl.com/s2l8w
In IE6, putting the mouse on each of the two items highlights the word
in a blue (different image) and shows a tool tip. In Firefox(1.5.0.6),
nothing shows when mouse goes over it. Please view the source of that
simple page (with some JavaScript) to see if you know how I can get
this to look in Firefox like it does in IE?
The problem is that your script is written for IE/NN4 era browsers using
document.layers and document.all. The only reason it even works in IE is
that it still supports document.all and the test for it. Firefox has
limited supported for document.all but it will fail on an
if(document.all) test. Although I personally don't see any reason at all
for using either one.
You use the images collection in the imgoff function but for some reason
you use document.layers/document.all in the imgon function.
I also don't see why you are having so many different function calls for
a simple rollover effect.
function swapImage(imgRef,newSource){
imgRef.src = newSource;
}
And call it as such:
<img src="originalImage.jpg"
onmouseover="swapImage(this,'newImageSrc.jpg')"
onmouseout="swapImage(this,'originalImage.jpg')"
>
The problem with the approach you have now is that when there are many
images on the page, your imgoff function will have to loop through all
the images and set them when it doesn't need to. The only image that
won't be in a default state is the one that has the mouse over it. When
you mouseout, you change it back.
--
Randy
comp.lang.javascript FAQ -
http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices -
http://www.JavascriptToolbox.com/bestpractices/