I have a simple script that checks if a particular file is the background image for a given div befpre swapping the image for a rollover effect. The code I have works perfectly in firefox and IE, but i can’t get it to work in safari or IE:Mac. I was wondering if anyone knew of a work around for this problem.
The working firefox/IE code is as follows:
function hover(button) {
if (document.getElementById(button).style.backgroundImage != "url(/images/buttons/"+button+"_down.gif)") {
document.getElementById(button).style.backgroundImage="url(images/buttons/"+button+"_on.gif)";
}
}
To clarify…what doesnt work is the check in the if statement…this seems to allow the contents of the if statment to be executed in safari or IE:MAC, regardless of whether the != check is true or not…
Thanks for your help in advance.