[thelist] Show hide <div>

fstorr fffrancis at fstorr.demon.co.uk
Sun Jan 5 17:37:01 CST 2003


> well, current_menu starts out as a null value.  whenever a
> menu is shown, current_menu is set to the id of the menu
> that's being shown.  then, next time a menu is displayed, the
> function checks to see if there's a menu already being shown.
>  if so, it hides it.  if the menu to be shown is different
> than current_menu, then that menu is displayed.  if the
> current_menu and the menu that's to be toggled are the same
> that means the menu is already open.  so, close it and set
> current_menu back to null.
>
> did that make sense?

+++++++

Hi .jeff

Yeah, I think so.  Just to make sure:

if(current_menu) ****** this line checks to see if the value is anything
other than null

{oMenu = document.getElementById(current_menu); ****** if it is, hide
the <div>
 oMenu.style.display = 'none';			****** with the id value
of current_menu
}

oMenu = document.getElementById(menuId);		****** now get
the value passed to the function
if(oMenu.style.display == 'none' && current_menu != menuId) ****** check
to see if display

****** not none for not the same as already open
{oMenu.style.display = 'block'; ****** set display to block
 current_menu = menuId;		  ****** set value of current_menu to
that of menuId
}

Else					****** if current_menu was a
null value, keep it null and return
current_menu = null;
return false;
}
}

Is that right?

Francis






More information about the thelist mailing list