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:49
drawMenus() mm_menueditapi dynamically created menu - SOLVED
Poster: briatx
Dated: Wednesday November 8 2006 - 23:44:53 GMT
Hi everyone,
Small problem here that I hope someone has an answer to.
I have a basic horizontal menu that is our basic navigation on our site.
I am working on adding a context menu, but one created dynamically with javascript using the mm_menueditapi.
The main menu created with drawMenus() works, and I have seen articles on how to do multiple menus with multiple calls to drawMenus(). That's not the problem, however.
The dynamically created mm_menueditapi works by itself, and it does pop up correctly when on the same page as the drawMenus() menu.
However, when I start to mouseover the dynamic context menu created with mm_menueditapi, then something strange happens. It appears that the menu thinks I'm also mousing over the main menu at the top that was created with drawMenus().
The main menu is named something like "mainmenu" and the other menu has a name like "Assignment Menu". The names should be different, so this should work?
Is there a way to specify that the menu created with mm_menueditapi is a 2nd "main menu" rather than linked to the first? Or does anyone know why mousing over one menu would affect another one if they are named differently?
Thanks for any help or suggestions.
brian.
Poster: briatx
Dated: Thursday November 9 2006 - 6:39:14 GMT
Thought I might add some code to this.
Basically, I'm using a slightly modified mm_addMenu function to allow me to set the name of the created menu, instead of getting the automated menu5 or whatever. I also commented out the popup so that the menu would stay hidden until i popped it up myself.
Code:
function mm_addContextMenu()
{
var a=arguments
var n=_m.length;
with(milonic=new menuname(a[3])){
style=a[0];
alwaysvisible=false;
if(a[1])eval(a[1])
_itemProps=""
if(a[2])_itemProps=a[2]
_bl=_mi.length
aI("text=New Item;"+_itemProps);
}
mm_createNewMenus();
//popup("newmenu"+n,1)
return n;
}
{
var a=arguments
var n=_m.length;
with(milonic=new menuname(a[3])){
style=a[0];
alwaysvisible=false;
if(a[1])eval(a[1])
_itemProps=""
if(a[2])_itemProps=a[2]
_bl=_mi.length
aI("text=New Item;"+_itemProps);
}
mm_createNewMenus();
//popup("newmenu"+n,1)
return n;
}
Poster: briatx
Dated: Thursday November 9 2006 - 6:46:53 GMT
Nevermind guys, looks like I was silly and had some milonic files included twice.
I guess that really does make a difference.
Ok, well note for posterity. Mouse over on one menu doing weird stuff to a second menu, check for double includes. (Any way to set up sentinels/guards in js?)