DHTMLX Docs & Samples Explorer

### Setting Visible Area

Source

    <link rel="stylesheet" type="text/css" href="../../codebase/skins/dhtmlxmenu_dhx_skyblue.css">
    <script src="../../codebase/dhtmlxcommon.js"></script>
    <script src="../../codebase/dhtmlxmenu.js"></script>
    <script src="../../codebase/ext/dhtmlxmenu_ext.js"></script>

    <div id="contextArea" style="position: relative; left: 20px; top: 20px; width: 600px; height: 400px; border: #C1C1C1 1px solid; background-color: #E7F4FF;"></div>

    <br>
    <script>var menu;
    function initMenu() {
        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("contextArea");
        menu.setIconsPath("../common/imgs/");
        menu.renderAsContextMenu(true);
        menu.setVisibleArea(x1, x2, y1, y2);
        menu.loadXML("../common/dhxmenu.xml?e=" + new Date().getTime());
    }</script>