| Sample: dhtmlxMenu | Building Context Menu with script | dhtmlxMenu main page |

Test zone 1 Test zone 2 Test zone 3
Press right mouse button on one of test zones.

    <script>
            //init context menu
            aMenu=new dhtmlXContextMenuObject('120',0,"../../codebase/imgs/");

            //set css
            aMenu.menu.tableCSS="menuTable";

            //create menu item
            var item = new dhtmlXMenuItemObject("edit_Red","Red","","../../codebase/red.gif","contextMenu");
            aMenu.menu.addItem(aMenu.menu,item);
            var item = new dhtmlXMenuItemObject("edit_Green","Green","","../../codebase/green.gif","contextMenu");
            aMenu.menu.addItem(aMenu.menu,item);
            var item = new dhtmlXMenuItemObject("edit_Blue","Blue","","../../codebase/blue.gif","contextMenu");
            aMenu.menu.addItem(aMenu.menu,item);
            var item = new dhtmlXMenuItemObject("outher","Other...","120","","contextMenu");
            aMenu.menu.addItem(aMenu.menu,item);
            //create submenu
            var subMenu = new dhtmlXMenuBarPanelObject(aMenu.menu,item,false,120,true);

            //add item to submenu
            var item = new dhtmlXMenuItemObject("edit_Yellow","Yellow","120","../../codebase/yellow.gif","contextMenu");
            aMenu.menu.addItem(subMenu,item);
            var item = new dhtmlXMenuItemObject("edit_White","White","120","../../codebase/white.gif","contextMenu");
            aMenu.menu.addItem(subMenu,item);

            aMenu.setContextMenuHandler(onButtonClick);

            //set context zones
            aMenu.setContextZone("alfa1",1);
            aMenu.setContextZone("alfa2",2);
            aMenu.setContextZone("alfa3",3);</script>