Milonic provide full featured pull down web menus for some of the worlds largest companies
click here to see what it can do for you

Download Milonic DHTML Menu
Buy Milonic DHTML Menu

Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:15

js change showmenu item


Poster: Maz
Dated: Tuesday September 2 2003 - 0:25:19 BST

This is not a functional yet so I may be going about it wrong, but its an interesting concept so I want to know if it works.

I have a site member login form, can I switch the menu item something like this:

url=javascript:goin(replace:showmenu=memberarea);

This is all guesswork ;)

Thanks
maz


Poster: Hergio
Dated: Tuesday September 2 2003 - 14:33:11 BST

No i wouldn't recommend doing it that way. I dont even think its possible without know the innards of the menu. Once you authenticate the user, just have a different menu appear using an if/else statement, two options below.

Code:
////THIS EXAMPLE YOU ALWAYS POINT TO A PARTICULAR MENU BUT YOU CREATE IT DIFFERENTLY BASED ON AUTHENTICATION
...
aI("text=Your Options;showmenu=dynamicMenu;");
if( userIsGuest )
{
    with(milonic=new menuname("dynamicMenu")){
    ....
    aI("text=Your a gues so Login;url=login.asp;");
    ....
}
if( userIsMember )
{
    with(milonic=new menuname("dynamicMenu")){
    ....
    aI("text=Welcome Member;url=yourMemberStuff.asp;");
    ....
}
....

///THIS EXAMPLE THERE ARE TWO MENUS, BUT YOU POINT TO DIFFERENT ONES BASED ON AUTHENTICATION

if( userIsGuest )
{
    aI("text=Your Options;showmenu=guestMenu;");
}
if( userIsMember )
{
    aI("text=Your Options;showmenu=memberMenu;");
}

with(milonic=new menuname("guestMenu")){
....
aI("text=Your a gues so Login;url=login.asp;");
....

with(milonic=new menuname("memberMenu")){
....
aI("text=Welcome Member;url=yourMemberStuff.asp;");
....


Poster: Maz
Dated: Tuesday September 2 2003 - 20:02:34 BST

My first attempt produced, notamember is undefined, I expect that.
Then _gmD style is not an object.

I still have to create the second menu, or does notamember need quotes?

Thank you
maz


Poster: Hergio
Dated: Wednesday September 3 2003 - 2:36:00 BST

Umm, ok I shoulda elaborated. My fault Maz. When I say userIsMember and userIsGuest, those were example variables I made up that would be your test as to whether someone was authenticated. You have to declare these variables and set them somewhere (usually when you authenticate them).
Like before all the menu code, you would grab their username and password from textboxes and then pass them to a database or check them against a file, and if they successfully login (they match a user in the DB) then you set userIsMember to TRUE and userIsGuest to FALSE. Vice versa when they are guests. See what I meant? It would actually be easier to set one variable called isMember to FALSE and then check to see if they are a member, and set it to true if they are, and leave it false if they arent. Then in your if/else statements, you say
if( isMember ){ ///display the member menu stuff // }
if( !isMember ){ ///display the guest menu stuff // }
The ! is front of the variable says "NOT isMember" so that would mean they are a guest. Sorry I confused you. You probably are getting the style error because of your undefined variable too.


Poster: Maz
Dated: Wednesday September 3 2003 - 14:36:23 BST

Second guessing I thought that might be the problem, and I did leave off is-not-a-member because there was no need to check for general display.
I won't know the outcome until its set up properly.

Thank you
maz