Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DHTML in Mozilla

Status
Not open for further replies.

paintbrush420

Programmer
Aug 9, 2004
3
US
Greetings all. I have an issue with Mozilla compatibility that has me stumped. I am trying to get a simple show/hide script working for a DHTML drop down navigation. It doesn't seem to want to use getElementByID(x).style to swap out visible/hidden in the div's style element (That is what the Mozilla site is suggesting as standards compatible.) Works beautifully in NS and IE. But I'm getting a javascript error that the ID of the div tag is not defined even though it is.

Gecko has me by the ropes. Any ideas?
 
This might be your problem...

instead of this: getElementByID(x)

use this: getElementById(x)

Javascript is case sensitive!

There's always a better way. The fun is trying to find it!
 
Thanks, but that's not it. I am used to searching for case sensitive JS bitchyness when things go awry.

Still hammering away at this. Any other takers?
 
Can you post a link to the page or post the code itself?

There's always a better way. The fun is trying to find it!
 
Well, tvi, with the deadline looming over me I decided just abandon that approach and use the display property and some strategically placed .gifs to fake the same effect. Not elegant, but the users will never know.

Perhaps I will post the code after the crunch is over and we can all sort it out.

Thanks for the advice,
P420
 
This little tidbit works for me in IE and Mozilla(& Firefox) to show/hide divs:
Code:
div = document.getElementById(id);
div.style.display=(div.style.display=="block")?"none":"block";

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top