Forum Moderators: open
I'm having an issue with FireFox and a Javascript Toggle function I found on the net. The Toggle in itself does work but I want to take it a step further so that when I enable one Div, it disables the other two Divs. The code works as intended in IE, but it does not disable the other two Divs in Firefox.
Here is the link to the site:
The Navigation menu is where I am using this feature (Account, Administrate, Site). Clicking these should display a seperate set of Nav links and hide the other sets.
Here is my Javascript code:
NAVSITE, NAVADMIN, NAVCCOUNT being the ID names of the 3 Divs.
function toggleNav(div)
{
divObj = document.getElementById(div);
if (divObj.style.display == "block")
{
divObj.style.display = "none";
}
else
{
divObj.style.display = "block";
}
if (NAVSITE == divObj)
{
NAVACCOUNT.style.display = "none";
NAVADMIN.style.display = "none";
NAVSITE.style.display = "block";
}
if (NAVACCOUNT == divObj)
{
NAVACCOUNT.style.display = "block";
NAVADMIN.style.display = "none";
NAVSITE.style.display = "none";
}
if (NAVADMIN == divObj)
{
NAVACCOUNT.style.display = "none";
NAVADMIN.style.display = "block";
NAVSITE.style.display = "none";
}
}
Is anyone aware of any fixes to get this to work in Firefox? Thanks in advance!
[edited by: encyclo at 3:08 am (utc) on Feb. 17, 2007]
[edit reason] no URLs please, see TOS [webmasterworld.com] [/edit]
var NAVSITE = getElementById('NAVSITE'); etc...
Alternatively use...
if (divObj.id == 'NAVSITE') etc...
or perhaps
if (divObj.id.toLowerCase() == 'navsite') etc...
Incidentally, links to personal urls are not allowed.
Kaled.