SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast mike7896's Avatar
    Join Date
    Jun 2004
    Location
    New Bedford, MA
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Help with Swtich Menu please

    I'm using the Switch Menu from dynamicdrive.com I need to modify it so that I have another level of submenus.

    For Instance, "Sub1" should be hyperlinked and when you click on it, it will drop down to another submenu level. I hope this makes sense. The code is below.

    Thanks in advance!

    -Mike

    <html>
    <head>

    <!--Menu-->
    <script type="text/javascript">

    /***********************************************
    * Switch Menu script- by Martial B of http://getElementById.com/
    * Modified by Dynamic Drive for format & NS4/IE4 compatibility
    * Visit http://www.dynamicdrive.com/ for full source code
    ***********************************************/

    if (document.getElementById){ //DynamicDrive.com change
    document.write('<style type="text/css">\n')
    document.write('.submenu{display: none;}\n')
    document.write('</style>\n')
    }

    function SwitchMenu(obj){
    if(document.getElementById){
    var el = document.getElementById(obj);
    var ar = document.getElementById("masterdiv").getElementsByTagName("span"); //DynamicDrive.com change
    if(el.style.display != "block"){ //DynamicDrive.com change
    for (var i=0; i<ar.length; i++){
    if (ar[i].className=="submenu") //DynamicDrive.com change
    ar[i].style.display = "none";
    }
    el.style.display = "block";
    }else{
    el.style.display = "none";
    }
    }
    }

    </script>
    <!--End Menu-->
    </head>

    <body>

    <!--SWITCH MENU-->
    <div id="menu">
    <!-- Keep all menus within masterdiv-->

    <div id="masterdiv">
    <div class="menutitle" onclick="SwitchMenu('sub1')">
    <a href="#Item1" name="Item1">Item1</a></div>
    <span class="submenu" id="sub1">
    - Sub1<br>
    - Sub2<br>
    - Sub3<br>
    </span>

    <div class="menutitle" onclick="SwitchMenu('sub2')">
    <a href="#Item2" name="Item2">Item2</a></div>
    <span class="submenu" id="sub2">
    - Sub1<br>
    - Sub2<br>
    - Sub3<br>
    </span>
    <div class="menutitle" onclick="SwitchMenu('sub3')">
    <a href="#Item3" name="Item3">Item3</a></div>
    <span class="submenu" id="sub3">
    - Sub1<br>
    - Sub2<br>
    - Sub3<br>
    </span>
    <div class="menutitle" onclick="SwitchMenu('sub4')">
    <a href="#Item4" name="Item4">Item4</a></div>
    <span class="submenu" id="sub4">
    - Sub1<br>
    - Sub2<br>
    - Sub3<br>
    </span>
    <div class="menutitle" onclick="SwitchMenu('sub5')">
    <a href="#Item5" name="Item5">Item5</a></div>
    <span class="submenu" id="sub5">
    - Sub1<br>
    - Sub2<br>
    - Sub3<br>
    </span>
    </div>
    <!--END OF SWITCH MENU-->
    </div>
    </div>

    </body>
    </html>

  2. #2
    SitePoint Enthusiast mike7896's Avatar
    Join Date
    Jun 2004
    Location
    New Bedford, MA
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Man, not a single reply! Thanks guys.


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
  •