Is it possible to pass a variable to a sub-menu from a parent menu.
.
.Parent Menu
.
aI("text=Parent Menu;showmenu=ChildMenu;onfunction=setM(1);");
.
.
.
.
.Child Menu
.
aI("text=Child Menu;url=http://www.hello.com/?"+mVal+";");
.
.
.
function setM(t){
mVal=t;
}
Is there any way of doing this?
thanks!
Jeff
Passing Parent Menu Variable to a Sub-Menu
Hi Jeff,
As far as I know, you can't do it the way you've suggested, mainly because the menus are generated when the page loads. You may be able to change the url of a menu item programatically, but I've never tried that, so I'd have to look into that a bit more (anyone else tried that?).
Another possibility is: Use your setM() function to set the global mVal (or whatever else) with your parent menu's onfunction call, as you've already designed. Then, instead of url=http://yada_yada_yada, set the child menu's url to a function call, like url=javascript:setUrl(); (so it'd be like an onclick). The setUrl() function could then change the page's href according to the global mVal (or others) that you set in the parent menu.
Hope that helps,
Kevin
As far as I know, you can't do it the way you've suggested, mainly because the menus are generated when the page loads. You may be able to change the url of a menu item programatically, but I've never tried that, so I'd have to look into that a bit more (anyone else tried that?).
Another possibility is: Use your setM() function to set the global mVal (or whatever else) with your parent menu's onfunction call, as you've already designed. Then, instead of url=http://yada_yada_yada, set the child menu's url to a function call, like url=javascript:setUrl(); (so it'd be like an onclick). The setUrl() function could then change the page's href according to the global mVal (or others) that you set in the parent menu.
Hope that helps,
Kevin
Here is a copy of how your data file should look.
Note though that this will not yet be possible until we release the next version of the menu. Current is Version 5.0 RC18 so anything after that will contain the new updates. We are hoping for a full production release in the next few days.
Regards
Andy
Note though that this will not yet be possible until we release the next version of the menu. Current is Version 5.0 RC18 so anything after that will contain the new updates. We are hoping for a full production release in the next few days.
Code: Select all
_scrollAmount=5 // Used for Netscape 4 scrolling
_scrollDelay=10 // Used for Netscape 4 scrolling
_menuCloseDelay=500 // The delay for menus to remain visible on mouse off
_menuOpenDelay=150 // The delay for opening menus on mouse over
_subOffsetTop=0; // Sub menu offset Top position
_subOffsetLeft=0; // Sub menu offset Left position
with(vertStyle=new mm_style()){
onbgcolor = "#ffffcc";
oncolor = "black";
offbgcolor = "#5082e6";
offcolor = "#ffffff";
bordercolor = "#000000";
borderstyle = "solid";
separatorcolor = "black";
separatorsize = 1;
padding = 3
borderwidth=1
fontsize = "75%";
fontstyle = "normal";
fontfamily = "arial, verdana, tahoma";
subimage = "/images/arrow.gif";
}
function setM(t){
mVal=t;
}
function changeURL(){
_mi[_itemRef][2]=_mi[_itemRef][2]+mVal // change the URL for this menu item
txt="The link is now: "+_mi[_itemRef][2]
+"\n The text is: "+_mi[_itemRef][1]
+"\n This menu reference is: "+_mi[_itemRef][0]
+"\n This menu name is: "+_m[_mi[_itemRef][0]][1]
alert(txt) // just showing some variables
}
with(main=new menuname("mainmenu")){
top = 5;
style = vertStyle;
alwaysvisible = 1;
aI("text=Main 1;showmenu=sub1;onfunction=setM(1);");
aI("text=Main 2;showmenu=sub2;onfunction=setM(2);");
aI("text=Main 3;showmenu=sub3;onfunction=setM(3);");
}
with(main=new menuname("sub1")){
style = vertStyle;
aI("text=Menu 1 Item 1;clickfunction=changeURL();url=http://milonic.com/;");
aI("text=Menu 1 Item 2;clickfunction=changeURL();url=http://milonic.com/;");
aI("text=Menu 1 Item 3;clickfunction=changeURL();url=http://milonic.com/;");
}
with(main=new menuname("sub2")){
style = vertStyle;
aI("text=Menu 2 Item 1;clickfunction=changeURL();url=http://milonic.com/;");
aI("text=Menu 2 Item 2;clickfunction=changeURL();url=http://milonic.com/;");
aI("text=Menu 2 Item 3;clickfunction=changeURL();url=http://milonic.com/;");
}
with(main=new menuname("sub3")){
style = vertStyle;
aI("text=Menu 3 Item 1;clickfunction=changeURL();url=http://milonic.com/;");
aI("text=Menu 3 Item 2;clickfunction=changeURL();url=http://milonic.com/;");
aI("text=Menu 3 Item 3;clickfunction=changeURL();url=http://milonic.com/;");
}
drawMenus()
Andy
Mad man
- Heh I like it
Yeah, the structure of the menu has been built in such a way as to allow for pretty much any property to be viewed and changed.
The sample at http://milonic.com/menusample.php?sampleid=15 demonstrates this quite well.
I'm currently rewriting milonic_src.js to accept custom properties that users can use. Something like This will make things even more interesting.
Watch this space folks.
Cheers
Andy


Yeah, the structure of the menu has been built in such a way as to allow for pretty much any property to be viewed and changed.
The sample at http://milonic.com/menusample.php?sampleid=15 demonstrates this quite well.
I'm currently rewriting milonic_src.js to accept custom properties that users can use. Something like
Code: Select all
aI("text=Menu;custom=anything;");
Watch this space folks.
Cheers
Andy
You gotta be kidding me! Thats awesome. So essentially, what will that do? Where will it place those custom tags? Will it be like customTag=customVal in the menu will put a customTag="customVal" into the HTML element? So if we want we can do classes, styles, onclicks, onfocuses, etc etc?
Dave Hergert
Software Engineer
"Helping to make the menu better, one
at a time."
Software Engineer
"Helping to make the menu better, one
