CodeThatMenu Unlimited Depth Example

CodeThatMenu Unlimited Depth Example

<html>
<head>
<script language="javascript1.2" src="codethatsdk.js"></script>
<script language="javascript1.2" src="codethatmenupro.js"></script>
<script language="javascript1.2">
<!--

//create main menu
var MainMenu = new CMenu(null, 'MainMenu');

//retrieve the menu interface reference
var menu = MainMenu.obj();

//menu positioning
menu.Pos('pos', [10, 10]);

//menu style settings
menu.St('css', 'test1');
menu.St('bgcolor', '#CCCCCC');
menu.St('size', [100, 16]);
menu.St('align', 'center');
menu.St('shadow', {
	"color" : "#AAAAAA", "width" : 5
} );
menu.St('border', {
	"color" : "black", "width" : 1
} );
menu.St('imgendon', {
	"src" : "menu/img/ad.gif", "width" : 16, "height" : 16
} );
menu.St('imgendoff', {
	"src" : "menu/img/ar.gif", "width" : 16, "height" : 16
} );
menu.StOver('bgcolor', '#EEEEEE');
menu.StOver('css', 'test1');

//menu separator
menu.Separator( {
	"style" : {
		"bgcolor" : "black", "size" : [100, 1]
	}
} );

//1st item
var item = menu.addItem();
item.setText('Dynamic');
for (count = 0; count < 10; count++) {
	//create a submenu with some object definition
	var submenu = item.addPopup( {
		"position" : {
			"anchor_side" : "nw"
		}
	} );
	//add an item with object definition
	item = submenu.addItem({
		"text" : "Item 1 : 1", "action" : {
			"js" : "myfunc()"
		}
	} );
	var item = submenu.addItem({
		"text" : "Item 1 : 2", "action" : {
			"js" : "myfunc()"
		}
	} );
	item.St('bgcolor', 'lightblue');
}

//add 2nd item to the main menu
menu.addItem( {
	"text" : "Item 2"
} );

//add 3rd item to the menu, get the reference
item = menu.addItem();

//this item will be the separator
item.Type('separator');

//add 4th item
item = menu.addItem( {
	"text" : "Item 3"
} );

</script>
</head>
<body>
<script language="javascript1.2">
<!--

MainMenu.create();
MainMenu.run();

//-->
</script>