Results 1 to 2 of 2

Thread: main menu colour change when a sub menu selected

  1. #1
    Join Date
    Nov 2005
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default main menu colour change when a sub menu selected

    Hello all, i have a java script which i am using to expand a submenu when i click a main menu, i want to change the main menu color after the submenu is expanded how do i do it, could any one suggest me ....

    the following is the code block
    /////////////// Java Script ////////////

    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";
    }
    }
    }

    /////////////////// Html Code /////////////

    <div class="menutitle" onclick="SwitchMenu('sub1')"> <a href="romperindex.htm">Main menu</a></div>
    <span class="submenu" id="sub1">
    - <a href="submenu1.htm">submenu1</a><br>
    - <a href="submenu2.htm">submenu2</a><br>
    - <a href="submenu3.htm">submenu3</a><br>

    </span>
    </div>


    Thanks in advance for your help ......

  2. #2
    Join Date
    Nov 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    There should be stylesheet included with that script.
    Unfortunately I don't know which script you have posted.

    -Bill

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
  •