http://dynamicdrive.com/dynamicindex1/switchmenu.htm
I want to add a second level menu item to the existing design.
Currently only one level is possible.
Item 1
......link
......link
item 2
item 3
item 4
I want to show....
item 1
.....item 1a
.....item 1b
.....item 1c
.........link
.........link
item 2
So that when item 1a is clicked, only those items in that division are
collapsed.
I am assuming I can simply add a new variable, say "var item1" then copy the
script for the changes, and change "masterdiv" to "item1".
Or if anyone has a link to a similar layout with multiple layers I'll take a
look at it.
if (document.getEl ementById){ //DynamicDrive.co m change
document.write( '<style type="text/css">\n')
document.write( '.submenu{displ ay: none;}\n')
document.write( '</style>\n')
}
function SwitchMenu(obj) {
if(document.get ElementById){
var el = document.getEle mentById(obj);
var ar = document.getEle mentById("maste rdiv").getEleme ntsByTagName("s pan");
//DynamicDrive.co m change
if(el.style.dis play != "block"){ //DynamicDrive.co m change
for (var i=0; i<ar.length; i++){
if (ar[i].className=="su bmenu") //DynamicDrive.co m change
ar[i].style.display = "none";
}
el.style.displa y = "block";
}else{
el.style.displa y = "none";
}
}
}