Menu Visibility Functions

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
User avatar
nbarth
Super Advanced
Super Advanced
Posts: 41
Joined: Tue Jul 29, 2003 11:03 am
Location: Minnesota
Contact:

Menu Visibility Functions

Post by nbarth »

I was using version 3 and some one helped me to write these functions to show and hide menus. Could someone help me to write the 5.0 equivelant?

Code: Select all


// Menu Visibility Functions ----------------  

function mm_showMenu(menuName) // + , alwaysVis)
{
  var menuNum = getMenuByName(menuName);
  if (arguments.length > 1) {
    var menuArr = eval("menu" + menuNum);
    menuArr[7] = arguments[1];
  }
  SDiv("menu" + menuNum, 1);
}

function mm_hideMenu(menuName) // + , alwaysVis)
{
  var menuNum = getMenuByName(menuName);
  if (arguments.length > 1) {
    var menuArr = eval("menu" + menuNum);
    menuArr[7] = arguments[1];
  }
  SDiv("menu" + menuNum, 0);
}

User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

Hmmm... me thinks those look familiar....

How 'bout these:

Code: Select all

function mm_showMenu(menuName) // , alwaysVisState = optional. 1=on, 0=off
{
  if (arguments.length > 1) _m[getMenuByName(menuName)][8] = arguments[1];
  popup(menuName);
}

function mm_hideMenu(menuName) // , alwaysVisState = optional. 1=on, 0=off
{
  var menuNum = getMenuByName(menuName);
  if (arguments.length > 1) {
    _m[menuNum][8] = arguments[1];
  }
  menuDisplay(menuNum, 0);
}
Word of caution: the mm_showMenu() function will not work unless the named menu already has a position in which to open! In other words, that menu must (a) have a location -- e.g., top/bottom, screenposition -- already set in the menu definition, or (b) have already been opened from a different source, like a "higher-level" menu, or (c) have the positions programatically set through some other function (which is possible) prior to calling the mm_showMenu() function.

Hope that helps (and works!),

Kevin
User avatar
nbarth
Super Advanced
Super Advanced
Posts: 41
Joined: Tue Jul 29, 2003 11:03 am
Location: Minnesota
Contact:

They work!

Post by nbarth »

Thanks so much Kevin!

Nicholas
User avatar
Maz
Milonic God
Milonic God
Posts: 1717
Joined: Fri Jun 06, 2003 11:39 pm
Location: San Francisco
Contact:

Post by Maz »

I decided on a much simpler solution, I just placed my complete menu in one main menu item, it could be any kind of link you want, then open the main menu up from there :)

maz
User avatar
nbarth
Super Advanced
Super Advanced
Posts: 41
Joined: Tue Jul 29, 2003 11:03 am
Location: Minnesota
Contact:

I appreciate the suggestion

Post by nbarth »

maz,

I may have to try that.

Thanks,
Nicholas
Post Reply