Add/delete menu items

 
  • Add new image button  
  • click on any existing button for deleting it

  • <div id="menu_zone" style="width:600; height:50;"/> <script> //init menu aMenuBar=new dhtmlXMenuBarObject('menu_zone','100%',30,"Demo menu"); // set processing function aMenuBar.setOnClickHandler(onButtonClick); //load menu from xml aMenuBar.loadXML("_menu.xml") //show menu aMenuBar.showBar(); //add new button aMenuBar.addItem(parentPanel, new dhtmlXMenuItemObject(newId,newName, width, imageSrc)) //delete button aMenuBar.removeItem(itemId); </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