Sample: dhtmlxMenu Mixed initialization dhtmlxMenu main page
X

You can load some data from xml and add items with the script

Add sub-menu to File menu
Or click on any item in menu

 
<div id="menu_zone" style="width:600; height:50;"/>
<script>
 
        //init menu
        aMenuBar=new dhtmlXMenuBarObject('menu_zone','100%',30,"Demo menu");
        //set path to imgs folder
        aMenuBar.setGfxPath("../../codebase/imgs/");
        //load menu from xml
        aMenuBar.loadXML("_menu.xml")
        //show menu
        aMenuBar.showBar();
 
 
            //get File sub menu
            var subMenu = aMenuBar.getPanel("main_file");
            //create a new item, the 5th parametr is a css class
            var pItem = new dhtmlXMenuItemObject("_Programs","Programs",null,null,"menuButtonSecond");
            //add new item to sub menu
            aMenuBar.addItem(subMenu,pItem);
 
            //create new sub menu, the first parametr is parent subMenu
            var subMenu = new   dhtmlXMenuBarPanelObject(subMenu,pItem,false,120,true);
            //create new item
            var subItem = new dhtmlXMenuItemObject("10001","HSBC",null,null,"menuButtonSecond");
            //and attach it to submenu
            aMenuBar.addItem(subMenu,subItem);
</script>
Parameters passed to the constructor are:
  • object to attach menu to (should be loaded before calling constructor)
  • width of the menu
  • height of the menu
  • title of menu