-
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 ......
-
-
There should be stylesheet included with that script.
Unfortunately I don't know which script you have posted.
-Bill
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks