Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by R.M. on Oct 20, 2009 09:40
open dhtmlx forum
dhtmlXmenu: open context menu from javascript

Hello,

Is there any way to open a menu from javascript code ?

I've tried several ways without any result.

Regards.

Sample code:

    <div id="myMenu">
    <div id="contextArea">
        <br />
        <br />
        <br />
        <span onclick="javascript:ShowMe(this)">Show Menu....</span>
    </div>

<script>

var pObj = document.getElementById("contextArea");
var x1 = getAbsoluteLeft(pObj);
var x2 = x1 + pObj.offsetWidth;
var y1 = getAbsoluteTop(pObj);
var y2 = y1 + pObj.offsetHeight;

menu = new dhtmlXMenuObject("myMenu");
menu.setIconsPath("../common/imgs/");
menu.renderAsContextMenu(true);
menu.setVisibleArea(x1, x2, y1, y2);

menu.showContextMenu(0,0)

</script>


Answer posted by Alex (support) on Oct 21, 2009 00:41

Hello,

showContextMenu(x,y) method can be used to open menu in a certain position. Please, provide the complete demo where we can recreate the issue