Change items text
Select Item | (Click menu item to select) |
|
Current Item Text | ||
New Item Text |
</> Source
<!DOCTYPE html>
<html>
<head>
<title>Change items text</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<link rel="stylesheet" type="text/css" href="../../../codebase/fonts/font_roboto/roboto.css"/>
<link rel="stylesheet" type="text/css" href="../../../codebase/dhtmlx.css"/>
<script src="../../../codebase/dhtmlx.js"></script>
<script>
var myMenu;
var mid;
function doOnLoad() {
myMenu = new dhtmlXMenuObject({
parent: "menuObj",
icons_path: "../common/imgs/",
xml: "../common/dhxmenu.xml",
onclick: menuClick
});
myMenu.attachEvent("onClick", menuClick);
}
function menuClick(id) {
document.getElementById("item").innerHTML = id;
document.getElementById("item_text").innerHTML = myMenu.getItemText(id);
mid = id;
}
function update() {
var text = document.getElementById("item_new_text").value;
myMenu.setItemText(mid, text);
}
</script>
</head>
<body onload="doOnLoad()">
<div style="height: 250px;"><div id="menuObj"></div></div>
<div>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>Select Item</td>
<td width="10"> </td>
<td><div id="item">(Click menu item to select)</div></td>
</tr>
<tr>
<td>Current Item Text</td>
<td> </td>
<td><div id="item_text"> </div></td>
</tr>
<tr>
<td>New Item Text</td>
<td> </td>
<td><input id="item_new_text" type="text" value="New Item Text"> <input type="button" value="Update" onclick="update();"></td>
</tr>
</table>
</div>
</body>
</html>
Documentation
Check documentation to learn how to use the components and easily implement them in your applications.