context menu on a link or image

Hi!



I want a context menu on right click event for a link or image rather than any node of a dhtmlx tree & pass related arguments from the links or images to the event handling function. Is it possible?? If yes please write detail. Example: I want to pass the id of the image( of tag)of an image link to the handler.



Thanks a lot.

If you want to use context menu against any element on page, you can use its own API , which allow to attach menu to any DOM element.
Please check
dhtmlx.com/docs/products/dhtmlxM … ml#menu_mf
3.1.3 Contextual Menu Zones section

I tried using the code from samples. I am using php page. But the menu does not appear in proper position .It is displayed at the end of the page on the left. I used exactly the same code in my page but is not working properly. What could be the problem? Is php creating problem??


zone A


/* inside script tag under body*/

                menu_img = new dhtmlXMenuObject();
                menu_img.setImagePath("…/dhtmlxMenu/codebase/imgs/");
                menu_img.setIconsPath("…/samples/images/");
                menu_img.renderAsContextMenu();
                //menu_img.setOpenMode(“web”);               
                menu_img.loadXML("_context_img.xml");
                menu_img.addContextZone(“78”);
               

Probably you miss css menu files.
Here is a completed demo.

menudemo.zip (39.7 KB)

Oh I found the problem.The problem is in the css file I used i.e. dhtmlxmenu_aqua_sky.css . The demo has dhtmlxmenu_dhx_blue.css. Thanks for the info. Can you fix this issue & send me aqua_sky css file? I am using dthmlx 2.0 new release. thnx. I have even attached that css file.

dhtmlxmenu_aqua_sky.css (8.64 KB)

OOPS! Please ignore the previous answer.Sorry for that. I confirmed the problem. I didnt provide the skin name in dhtmlXMenuObject & so it looked for the default css file dhtmlxmenu_dhx_blue.css which I didnt include it in script .I included aqua_sky instead of that. Thanks. The problem is solved.