Forum Moderators: open

Message Too Old, No Replies

Problem with display in Firefox on a Mac

         

sebana

10:02 am on Dec 23, 2006 (gmt 0)

10+ Year Member



hi guys, been runinng into a weird problem.. the javascript code is as follows:

<script type="text/javascript">
<!--
function toggle_one() {
hk_female1.style.display = "";
hk_female2.style.display = 'none';
hk_male.style.display = 'none';
return true;
}
function toggle_two() {
hk_female1.style.visibility = 'none';
hk_female2.style.visibility = "";
hk_male.style.visibility = 'none';
return true;
}
function toggle_three() {
hk_female1.style.display = 'none';
hk_female2.style.display = 'none';
hk_male.style.display = "";

}

//-->
</script>

here's how i call it:

<a onmouseover="this.style.cursor='pointer'" onmouseout="this.style.cursor='default'" onclick="toggle_one();"><img src="ONE.gif"></a> <a onmouseover="this.style.cursor='pointer'" onmouseout="this.style.cursor='default'" onclick="toggle_two();"><img src="TWO.gif"></a> <a onmouseover="this.style.cursor='pointer'" onmouseout="this.style.cursor='default'" onclick="toggle_three();"><img src="THREE.gif"></a>

basically it's to toggle the display of 3 divs on and off, as you'd have expected.

it works well under Safari, and also on Firefox 2.0.0.1 when i view it as a html file offline.

however when i upload it to my webserver, this doesn't work anymore on Firefox 2.0.0.1, but Safari is still okay.

I wonder why is there a difference when i upload it to the webserver, and when i view it on my computer offline?

Seems like some specific code, does anybody have any idea?

Any help is appreciated. thanks!

mattcg

12:24 pm on Dec 24, 2006 (gmt 0)

10+ Year Member



Have you checked the error console in Firefox after you call the functions by clicking the link? Tools > Error console > scroll down to the bottom.

sebana

9:13 am on Dec 25, 2006 (gmt 0)

10+ Year Member



thanks mattcg, i didnt know there was this tool available..

i managed to track down that it one of the elements i tried to change was undeclared..

i guess i cant reference objects directly in the way of:

hk_female.style.display = ...

insteady i had to do a:

document.getElementId("hk_female").style.display = ...

this works correctly now in FF 2.0.0.1 and Safair. Thanks!