Results 1 to 6 of 6

Thread: Drop down menu not working in IE

  1. #1
    Join Date
    Mar 2006
    Location
    Cleveland, Ohio
    Posts
    574
    Thanks
    6
    Thanked 5 Times in 5 Posts

    Default Drop down menu not working in IE

    I wrote a drop down menu thing, with JavaScript and CSS, that is SUPPOSED to work in IE, as well as Mozilla...
    Now, the issue is: it's not working in Mozilla.
    I can't seem to figure out why.
    www.flamehtmlstudios.com/amanda/beta/ is the html
    www.flamehtmlstudios.com/amanda/beta/main.css is the css
    www.flamehtmlstudios.com/amanda/beta/nav.js is the javascript
    help?!

    ps - another question: is a script to use to get IE to display the hovers that don't work in it? For example, something like p:hover{border-color: black;} would work in firefox, but not IE. How would I get it to work in IE, too?

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    In Mozilla document.all is undefined or false, so everything here (in red) will not fire:

    Code:
    <!--//--><![CDATA[//><!--
    startList = function() {
    if (document.all&&document.getElementById) {
    navRoot = document.getElementById("nav");
    for (i=0; i<navRoot.childNodes.length; i++) {
    node = navRoot.childNodes[i];
    if (node.nodeName=="LI") {
    node.onmouseover=function() {
    this.className+=" over";
    }
    node.onmouseout=function() {
    this.className=this.className.replace(" over", "");
    }
    }
    }
    }
    }
    window.onload=startList;
    
    //--><!]]>
    Also, the green parts are not needed in an external script and could possibly cause problems in some browsers, though in this particular case I doubt it, safest thing is to get rid of them.

    Try getting rid of the green and changing this:

    Code:
    if (document.all&&document.getElementById) {
    to this:

    Code:
    if (document.getElementById) {
    Without testing, it looks like that should at least get it doing something in Mozilla, let us know.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Mar 2006
    Location
    Cleveland, Ohio
    Posts
    574
    Thanks
    6
    Thanked 5 Times in 5 Posts

    Default

    Ooops...I meant it's not working in IE...
    It was working in Mozilla...
    Still is in Mozilla...
    Still is NOT in IE...
    Last edited by alexjewell; 04-05-2006 at 12:08 AM.

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by alexjewell
    Ooops...I meant it's not working in IE...
    It was working in Mozilla...
    Still is in Mozilla...
    Still is NOT in Mozilla...
    Huh? Anyways, after looking at your css, which I skipped before, it (the css) alone can power this menu in Mozilla and Opera. The javascript is only for IE, because IE will not do :hover styles for anything other than an anchor link element. So, assuming the script is otherwise sound, I'd put back the document.all part and even add to it:

    Code:
    if (document.all&&document.getElementById&&(!window.opera)) {
    However here:

    Code:
    this.className=this.className.replace(" over", "");
    We have a syntax error, it should be:

    Code:
    this.className=this.className.replace(/ over/, "");
    If the code is otherwise selecting the correct elements to apply these events to and the .over class is appropriate, that should do it.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I tried it out in a local demo, and I'd say go back to the drawing board. Where did you get this code in the first place?
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. #6
    Join Date
    Mar 2006
    Location
    Cleveland, Ohio
    Posts
    574
    Thanks
    6
    Thanked 5 Times in 5 Posts

    Default

    I wrote it myself.
    Is it possible you could hook me up with a javascript code that would work?
    Thanks so much for even taking the time to work on it yourself before, too, it means a lot.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •