CodeThatMenu Items Actions Example

CodeThatMenu Items Actions Example

function openWin(win_width, win_height)
{
	var newwin = window.open('', '', 'copyhistory=0,directories=0,location=0,\
	menubar=0,scrollbars=yes,status=0,toolbar=0,\
	width=' + win_width + ',height=' + win_height + ',resizable=yes');
	newwin.moveTo(0, 0);
}

var MenuDef = {
	"type"	 : "bar",
	"style"	 : {
		"css" : "test2",
		"bgcolor" : "black",
		"box"	 : true,
		"size"	 : [231, 16],
		"direction" : "h",
		"color" : "white",
		"imgendon" : {
			"src" : "img/arr_down.gif", "width" : 16, "height" : 16
		},
		"imgendoff" : {
			"src" : "img/arr_right.gif", "width" : 16, "height" : 16
		}
	},
	"itemover" : {
		"css" : "test2", "bgcolor" : "black", "color" : "yellow"
	},
	"position" : {
		"absolute" : false, "pos" : [30, 20]
	},
	"defaction" : {
		"title" : "This is an action title"
	},
	"items" : [
	{
		"text" : "Examples of different actions",
		"menu" : {
			"style" : {
				"direction" : "v"
			},
			"position" : {
				"menuoffset" : {
					"x" : "-100", "y" : "16"
				}
			},
			"items"	 : [
			{
				"text" : "JS code - open small empty window",
				"action" : {
					"js" : "openWin(30, 30);return false"
				}
			},
			{
				"text" : "Go to URL",
				"action" : {
					"url" : "http://yahoo.com", "target" : "_blank", "title" : "Yahoo!!!!"
				}
			},
			{
				"text" : "Boolean item",
				"type" : "bool",
				"action" : {
					"on" : "alert(\'on!\'); ",
					"off" : "alert(\'off!\'); "
				}
			} ]
		}
	} ]
};