View Single Post
  #2 (permalink)  
Old 09-08-2008, 05:39 PM
Deadeye's Avatar
Deadeye Deadeye is offline
Moderator
 
Join Date: Aug 2005
Location: San Diego, CA
Posts: 278
Send a message via MSN to Deadeye
thats one way of doing it, or have a close all and call the before you "open" the correct menu.


Code:
function change_it(itemID) {
closeEverything();
document.getElementById(itemId).style.display = 'inline';
}
function closeEverything() {
document.getElementById("menu1").style.display = 'none';
document.getElementById("menu2").style.display = 'none';
document.getElementById("menu3").style.display = 'none';
...
}

OR

you can close everything and open the item all within the same method.

Code:
function change_it(itemID) {
switch(itemID)
case 1:
   document.getElementById("menu1").style.display = 'inline';
   document.getElementById("menu2").style.display = 'none';
   document.getElementById("menu3").style.display = 'none';
case 2:
   document.getElementById("menu1").style.display = 'none';
   document.getElementById("menu2").style.display = 'inline';
   document.getElementById("menu3").style.display = 'none';
....

}
I'd do it the first way that I've listed with the close everything of the 3 options listed so far.

Wesley
__________________
Don't forget to rate me A+++++++++++++++++!!!!!111one for the service you have received.
Reply With Quote