Connecting Tech Pros Worldwide Forums | Help | Site Map

table background in Mozilla vs IE

Sam Carleton
Guest
 
Posts: n/a
#1: Jul 20 '05
I am having problems with understanding how to change the background
of a table in Mozilla. On this page
<http://www.miltonstreet.com/scarleton/photo/index.php> I am setting
the background of the table to that of the image one can actually
see and then using a null image over it.

In IE, I have it working where when you move the mouse over the
image, the image changes to a different image. For some reason this
does not work in Mozilla. Any idea why?

Sam

Martin Honnen
Guest
 
Posts: n/a
#2: Jul 20 '05

re: table background in Mozilla vs IE




Sam Carleton wrote:
[color=blue]
> I am having problems with understanding how to change the background
> of a table in Mozilla. On this page
> <http://www.miltonstreet.com/scarleton/photo/index.php> I am setting
> the background of the table to that of the image one can actually
> see and then using a null image over it.
>
> In IE, I have it working where when you move the mouse over the
> image, the image changes to a different image. For some reason this
> does not work in Mozilla. Any idea why?[/color]

You have

function UpdateImage(nIndex)
{
var TableObj = document.getElementById("TheTable");
TableObj.background = ImageArray[nIndex].src;
}

make that

function UpdateImage(nIndex)
{
var TableObj = document.getElementById("TheTable");
if (TableObj && TableObj.style) {
TableObj.style.backgroundImage =
'url(' + ImageArray[nIndex].src + ')';
}
}

and it should work with IE4+, Netscape 6+, Opera 7
--

Martin Honnen
http://JavaScript.FAQTs.com/

Closed Thread