# dhtmlxmenu:api_constructor [DHX documentation]

DHTMLX Docs & Samples Explorer

Index
dhtmlxmenu
API Methods

## Constructor of dhtmlxMenu

            var menu = new dhtmlXMenuObject(parent, skin)

where

- parent - id of HTML element which will be used as parent (or object itself)
- skin - name of skin, optional (string)

          <div id='my_menu_here' style="width: 500px;"> </div>
          <script>
              // common init code
              var menu = new dhtmlXMenuObject("my_menu_here");
          </script>

dhtmlxLayout, dhtmlxWindow, dhtmlxAccordion and dhtmlxTabbar can create a menu inside their cells by using the following syntax:

          // attach to dhtmlxLayout
          dhxLayout.attachMenu();
          dhxLayout.cells(id).attachMenu();
          // attach to dhtmlxWindow
          dhxWins.window(id).attachMenu();
          // attach to dhtmlxAccordion
          dhxAcc.cells(id).attachMenu();
          // attach to dhtmlxTabbar
          dhxTabbar.cells(id).attachMenu();

Starting from 2.5 version, menu can be initialized by object notation

          var menu = new dhtmlXMenuObject({
              some_option1: some_value_1,
              some_option2: some_value_2,
              ...
              some_optionN: some_value_N,
          })

List of supported options

    	menu = new dhtmlXMenuObject({
    		parent:"a_menu",
    		image_path:"codebase/imgs/",
    		onClick:function(){
    			alert("Menu item was clicked");
    		}
    	});