DHTMLX Docs & Samples Explorer

Event Handling: CAS State (Single Loading)


Source
<link rel="stylesheet" type="text/css" href="../../codebase/skins/dhtmlxmenu_dhx_skyblue.css">
<script src="../../codebase/dhtmlxcommon.js"></script>
<script src="../../codebase/dhtmlxmenu.js"></script>
<script src="../../codebase/ext/dhtmlxmenu_ext.js"></script>
 
<div style="height: 250px;"><div id="menuObj"></div></div>
<div id="ta" style="width: 500px; height: 160px; border: #909090 1px solid; overflow: auto; font-size: 10px; font-family: Tahoma;"></div>
 
<br>
<script>
var menu = new dhtmlXMenuObject("menuObj");
menu.setIconsPath("../common/imgs/");
menu.loadXML("../common/dhxmenu.xml?e=" + new Date().getTime());
//;
menu.attachEvent("onClick", function(id, zoneId, casState) {
    document.getElementById("ta").innerHTML += "<b>onClick</b> '" + menu.getItemText(id) + "' was clicked, ctrl: " + (casState["ctrl"] ? "<b>true</b>": "false") + ", alt: " + (casState["alt"] ? "<b>true</b>": "false") + ", shift: " + (casState["shift"] ? "<b>true</b>": "false") + "<br>";
});
menu.attachEvent("onRadioClick", function(gruop, checked, clicked, zoneId, casState) {
    document.getElementById("ta").innerHTML += "<b>onRadioClick</b> '" + menu.getItemText(clicked) + "' was clicked, ctrl: " + (casState["ctrl"] ? "<b>true</b>": "false") + ", alt: " + (casState["alt"] ? "<b>true</b>": "false") + ", shift: " + (casState["shift"] ? "<b>true</b>": "false") + "<br>";
    return true;
});
menu.attachEvent("onCheckboxClick", function(id, state, zoneId, casState) {
    document.getElementById("ta").innerHTML += "<b>onCheckboxClick</b> '" + menu.getItemText(id) + "' was clicked, ctrl: " + (casState["ctrl"] ? "<b>true</b>": "false") + ", alt: " + (casState["alt"] ? "<b>true</b>": "false") + ", shift: " + (casState["shift"] ? "<b>true</b>": "false") + "<br>";
    return true;
});
</script>