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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DHTML Javascript displays/runs in IE, not Firefox

Status
Not open for further replies.

MamaGeek

Programmer
Feb 22, 2006
5
US
I wrote a script that generates a nice custom dropdown menu for my website. It displays/runs fine in IE, which is where I developed it, but does not work in Firefox. The Firefox Javascript debugger does not report any errors, so I think it's probably a CSS problem, not a Javascript problem. Can anyone help me?

The script:

My website using the script: (open in IE to see it working)
If you open the website in IE, there is a row of tabs under the title graphic. Click on Writings, for instance, and a list of links drops down.
 
Your problem is this line:

Code:
dropDowns[menuIndex].style.zIndex = -1;

You are telling Firefox to put the menu behind the container. Even though the menu should stick out from below the container, it is still being pushed to the background - which, AFAIK, is correct behaviour for this use of z-index.

To work around it, remove the -1 z-index, and position your image using another positioned div so that it has a higher z-index than the menu.

That fix aside, I think you need to rewrite that code, for many reasons, including:

- You're using tables when you don't really need to.

- You're mixing and matching DOM methods with innerHTML. Why? Use one or the other... there's no point in using DOM methods if you're happy with using innerHTML.

- You should remove the font tags, and use CSS to style the menus instead.

- Your variable names are misleading. For example, "menuSpan" holds a pointer to a div element, not to a span element.

Incidentally, a lot (about 50%) of the free Peach Blue Nautical Kit downloads do not work - they give a "file not found" error.

Hope this helps,
Dan

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Thank you so much for your help! I know it's not the most elegant code. I usually program in C or C++, and I just kind of threw this together as whatever I could get to work. I appreciate all your comments.

Yeah, I know about the digital scrapbooking downloads - I didn't finish uploading them last night. They'll be up soon.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top