Text label
</> Source
<!DOCTYPE html>
<html>
<head>
<title>Text label</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 myToolbar;
var sel;
function doOnLoad() {
sel = document.getElementById("sel");
myToolbar = new dhtmlXToolbarObject({
parent: "toolbarObj",
icons_path: "../common/imgs/",
xml: "../common/dhxtoolbar_text.xml",
onload: updateList
});
}
function setText(text) {
myToolbar.setItemText(sel.options[sel.selectedIndex].value, document.getElementById("txt").value);
updateList();
}
function getText() {
var text = myToolbar.getItemText(sel.options[sel.selectedIndex].value);
if (text == "") text = "This item has no text";
alert(myToolbar.getItemText(sel.options[sel.selectedIndex].value));
}
function updateList() {
sel.options.length = 0;
myToolbar.forEachItem(function(itemId){
if (myToolbar.getType(itemId) == "text") {
sel.options.add(new Option(myToolbar.getItemText(itemId), itemId));
}
});
}
</script>
</head>
<body onload="doOnLoad()">
<div id="toolbarObj"></div>
<div style="margin-top: 20px;">
<select id="sel">
<option value="text">dhtmlxToolbar Demo</option>
</select>
<input type="button" value="Get Text" onclick="getText();">
<input type="button" value="Set Text" onclick="setText();">
<input id="txt" type="text" value="New Text">
</div>
</body>
</html>
Documentation
Check documentation to learn how to use the components and easily implement them in your applications.