var myMenu = new dhtmlXMenuObject(parent, skin);
where
skin - name of skin, optional (string)
The full list of initialization options is given below.
<div id='my_menu_here' style="width: 500px;"> </div>
<script>// common init code
var myMenu = 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 Layout
myLayout.attachMenu();
myLayout.cells(id).attachMenu();
// attach to Window
myWins.window(id).attachMenu();
// attach to Accordion
myAcc.cells(id).attachMenu();
// attach to Tabbar
myTabbar.cells(id).attachMenu();
Menu can also be initialized by object notation
var myMenu = new dhtmlXMenuObject({
parent:"a_menu",
image_path:"codebase/imgs/",
onClick:function(){
alert("Menu item was clicked");
}
});
menu items can be defined through items collection
myMenu = new dhtmlXMenuObject({
parent:"a_menu",
items:[
{id:"t1", text:"Top 1", items:[
{id:"ch1", text:"child 1"},
{id:"ch2", text:"child 2"}
]}
]
});
Each item can have next attributes: