Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: Drop Down Menu

  1. #1
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Drop Down Menu

    Hi Could you help me please. I am trying to make this drop down menu work in Internet Explorer 7 by inserting the Javascript. I'm obviously doing something wrong. Please be gentle with me I'm a bit of a newcomer to this:

    HTML and Javascript included below.

    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Untitled Document</title>

    <script type="text/javascript">

    sfHover = function() {
    var sfEls = document.getElementById("nav").getElementsByTagName("LI");
    for (var i=0; i<sfEls.length; i++) {
    sfEls[i].onmouseover=function() {
    this.className+=" sfhover";
    }
    sfEls[i].onmouseout=function() {
    this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
    }
    }
    }
    if (window.attachEvent) window.attachEvent("onload", sfHover);

    </script>

    <link href="dropdownmenu.css" rel="stylesheet" type="text/css" />
    </head>

    <body>
    <ul class="nav">

    <li><a href="/home/">Home </a></li>
    <li><a href="/products/">Products </a>

    <ul>

    <li><a href="/products/silverback/">Silverback </a></li>
    <li><a href="/products/fontdeck/">Font Deck </a></li>

    </ul>

    </li>

    <li><a href="/services/">Services </a>

    <ul>

    <li><a href="/services/design/">Design </a></li>
    <li><a href="/services/development/">Development </a></li>
    <li><a href="/services/ consultancy/">Consultancy </a></li>
    </ul>

    </li>

    <li><a href="/contact/">Contact Us </a></li>

    </ul>



    </body>
    </html>

  • #2
    New Coder
    Join Date
    Sep 2010
    Location
    U S of A
    Posts
    67
    Thanks
    0
    Thanked 13 Times in 13 Posts
    Here is one problem ...

    document.getElementById("nav")

    you dont have an element with the id = "nav"

  • Users who have thanked Shaka Zorba for this post:

    MichelleMary (12-08-2010)

  • #3
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts
    OK thank you for that. I will change the 'class' nav to id 'nav'.


  •  

    Posting Permissions

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