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:08

Determine which menu item is clicked in javascript


Poster: mkh100
Dated: Wednesday April 5 2006 - 11:27:17 BST

I have a simple menu like:

Code:
with(milonic=new menuname("FileMenu")){
style=menuStyle;
aI("text=New;url=javascript:menuclick(\"my parameter\",this);");
aI("text=Open;url=http://www.milonic.com/contactus.php;");
aI("text=Delete;url=http://www.milonic.com/newsletter.php;");
}


And basically want to call a javascript function called menuclick when an item in the menu is clicked. The above code works fine for this and

Code:
function menuclick(text,obj)
{
    alert(text);
}


works as expected, when New is clicked on the above menu. However I also want to manipulate the menu item that was clicked, and realise that this (as a second paramenter) returns the rendered DOM, not as I want a reference to the clicked menu item.

Looking at http://www.milonic.com/menu_methods.php it looks like gmobj("FileMenu") will get me the menu, but how do I get a reference to the clicked menu item? Is there a way of finding it's id (then I can use gmobj) or a way of getting a reference to the nth item in a menu (that I could then pass as a paramenter)?

What I am trying to do is to build a menu to allow the visibility of elements on the page to be controlled, and need a tick image to be toggled on and off depending upon weather or not that layer is currently showing.

Any help or pointers much appreciated

-Michael


Poster: Migru
Dated: Wednesday April 5 2006 - 11:47:35 BST

Hi

did you check if you find among the Bolt-on modules what you need ?

http://www.milonic.com/menumodules.php

Michael