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:13
know the number of links in a sub menu
Poster: rmamidipally
Dated: Friday February 24 2006 - 8:53:07 GMT
Hi,
I am using lecenced version of Milonic menu.
In mycase I get the links in a submenu dynamically.
I am using teh divhider.js .
I have make the div hide based on the number of links.
Ex:
If a sub menu has 12 links I need not hide the div.
If it has 13 links I have to.Because under teh 13 link there is the select box.
Is there any way I can know the number of links in a sub menu?
Plz help me.
Thanks,
Ravi.
Poster: Andy
Dated: Friday February 24 2006 - 15:56:08 GMT
Hi,
Try something like this:
Code:
<script>
menuname="Main Menu";
menunumber=getMenuByName(menuname);
alert(_m[menunumber][0].length)
</script>
menuname="Main Menu";
menunumber=getMenuByName(menuname);
alert(_m[menunumber][0].length)
</script>
Assuming you want to know the number of items inside "Main Menu" - Just change the menu name in order to get the number of items from another menu
How to know parent menu?
Poster: rmamidipally
Dated: Monday February 27 2006 - 13:53:19 GMT
Thank you Andy.
My problem is solved.
I have another issue. Please help me in this also.
I have a sub menu link, same in two menus.
But for the same link I have to invoke different actions based on the menu it is being called from.How to know the parent menu?
Ex:
I have two menus A and B.
C is the sub menu link that exists in both A and B.
If C of A is clicked I should call D and if C of B is clicked I should call E.
For that I want to know the parent menu of the link being clicked.
Please help me.
Thanks,
Ravi.
Poster: Andy
Dated: Monday February 27 2006 - 14:00:50 GMT
It's as easy as pie:
getParentMenuByItem(itemReference)
Try this:
Code:
alert(getParentMenuByItem(_itemRef));
Should return the number of the parent menu, if you want the parent menu name, the try this:
Code:
alert(_m[getParentMenuByItem(_itemRef)][1]);
Hope this helps,
Andy