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:54
Can't find a menu
Poster: pservedio
Dated: Saturday September 23 2006 - 2:40:16 BST
I'm trying to dynamically update the text of a menu (not its items, doesn't have any...yet).
Based upon code from the forum I added this javascript function:
Code:
function mm_changeMenuProperty(menuName, propertyRef, newValue)
{
var menuNum = getMenuByName(menuName);
if (menuNum == null) {
alert("could not find menu "+menuName);
}
_m[menuNum][propertyRef] = newValue;
BDMenu(menuNum);
}
{
var menuNum = getMenuByName(menuName);
if (menuNum == null) {
alert("could not find menu "+menuName);
}
_m[menuNum][propertyRef] = newValue;
BDMenu(menuNum);
}
and in menu_data.js
Code:
with(milonic=new menuname("userMenu")){
alwaysvisible=1;
screenposition="left"
left="offset=320"
orientation="horizontal";
style=rightStyle;
top=89;
}
alwaysvisible=1;
screenposition="left"
left="offset=320"
orientation="horizontal";
style=rightStyle;
top=89;
}
So when I make my call to change the menu name on the screen in a javascript function:
Code:
mm_changeMenuProperty("userMenu", 1, userName);
I get the alert that the menu can't be found. However other menus could be found.
Any help would be appreciated.
Alternatively I could create this menu dynamically, but just can seem to find that sample page. If you think that'a a better way, let me know. The name of the menu is based upon a variable, and cannot be string literal.
My milonic id is 203386, winxp sp2, firefox 1.5.0.7
Poster: Ruth
Dated: Saturday September 23 2006 - 5:31:01 BST
Hi,
I don't think you can change the name of a menu, I believe the two things that won't work with that function are changing the name and changing the style. And it's probably not finding the menu because there's nothing in it.
What page are you seeking with regard to dynamic creation?
I did a search for mysql and dynamic menu, you can try the following links, though I have no idea if any will be of help.
http://support.milonic.com/datamenu/
http://www.milonic.com/xml_menu.php
http://www.milonic.com/createmenu.htm
http://www.milonic.com/forum/viewtopic. ... 6859#36859
http://www.milonic.com/forum/viewtopic. ... 6071#36071
http://www.milonic.com/forum/viewtopic. ... 5147#35147
Hope this helps.
Ruth
Poster: pservedio
Dated: Saturday September 23 2006 - 19:02:33 BST
This is incredibly frustrating...OK, so I try two other strategies, as seen in your post and on the forum:
#1: I try to change the name of a menu item, based on a function written by "Kevin" I think:
Code:
function mm_changeItemProperty(menuName, itemName, codeRef, newValue, updateDisplay)
{
menuName = menuName.toLowerCase();
for (i=0; i<_mi.length; i++)
if (_mi[i][1].replace(/\ \;/ig,' ') == itemName && _m[_mi[i][0]][1] == menuName) break;
if (i == _mi.length) {
alert("Could not find menu");
return;
}
_mi[i][codeRef] = newValue;
if (updateDisplay) BDMenu(_mi[i][0]);
}
{
menuName = menuName.toLowerCase();
for (i=0; i<_mi.length; i++)
if (_mi[i][1].replace(/\ \;/ig,' ') == itemName && _m[_mi[i][0]][1] == menuName) break;
if (i == _mi.length) {
alert("Could not find menu");
return;
}
_mi[i][codeRef] = newValue;
if (updateDisplay) BDMenu(_mi[i][0]);
}
With my menu in menu_data.js:
Code:
with(milonic=new menuname("userMenu")){
alwaysvisible=1;
screenposition="left";
left="offset=320";
orientation="horizontal";
style=rightStyle;
top=89;
aI("text=uname");
}
alwaysvisible=1;
screenposition="left";
left="offset=320";
orientation="horizontal";
style=rightStyle;
top=89;
aI("text=uname");
}
I make this call:
Code:
userName = xmlDoc.getElementsByTagName('user_name')[0].childNodes[0].nodeValue;
mm_changeItemProperty("userMenu", "uname", 1, userName, 1);
mm_changeItemProperty("userMenu", "uname", 1, userName, 1);
And get this error:
Quote:
_mi[i][1] has no properties
Can't remember JS scope but perhaps the "i" variable went out of scope, not sure.
#2: Based upon your suggestion in this page:
http://www.milonic.com/createmenu.htm
and in the sample found in the release I just bought, I tried this:
Code:
with(milonic=new menuname("uname")){
alwaysvisible=1;
screenposition="left";
left="offset=500";
orientation="horizontal";
style=rightStyle;
top=89;
aI("text="+userName+";url=;");
}
mm_createNewMenus();
popup("uname",1);
alwaysvisible=1;
screenposition="left";
left="offset=500";
orientation="horizontal";
style=rightStyle;
top=89;
aI("text="+userName+";url=;");
}
mm_createNewMenus();
popup("uname",1);
And I get an error message telling me that:
Quote:
Error: "_wid" is undefied.
This also happens in the sample that you ship out!!! (In the dynamic_menus_API folder, the index.html gets the same problem, in both IE and FF).
I just bought Milonic, I assume that I'm on the latest version, so what's the deal here?
It appears that _wid is defiend in mmenusns4.js, which is fine if you're on NS4, but I couldn't find it defined anywhere else (i.e mmenudom.js)! Either I'm making some serious newbie error or your QA is sloppy!
Poster: pservedio
Dated: Saturday September 23 2006 - 19:22:46 BST
Update:
If one comments out this line in mm_menueditapi.js. mm_createNewMenus():
//if(_wid)n.width=_excMD(_wid)
The example works. That being said, it's never a good idea to muck with 3rd party software. And of course, you can't set the width property.
Can we get a working version of this method?
Poster: Ruth
Dated: Sunday September 24 2006 - 4:15:13 BST
Hello,
Can you please contact Milonic? I will post a link for Milonic to this message, but I am only a volunteer and don't do or know anything about the programming.
Ruth
Poster: pservedio
Dated: Monday September 25 2006 - 5:35:49 BST
Ruth, thanks for your help...I assume "Andy" is Senor Milonic and will email him....
...Oops, private messaging has been disabled on this board, how can I contact him?
Poster: Ruth
Dated: Monday September 25 2006 - 17:52:10 BST
Hi,
http://www.milonic.com/support/
Ruth