<script type="text/javascript" src="../../codebase/dhtmlxcommon.js"></script>
<script type="text/javascript" src="../../codebase/dhtmlxtoolbar.js"></script>
<link rel="stylesheet" type="text/css" href="../../codebase/skins/dhtmlxtoolbar_dhx_skyblue.css"></link>
<div id="toolbarObj"></div>
<div style="margin-top: 20px;">
<select id="sel"></select>
<input type="button" value="Get Width" onclick="getWidth();">
<input type="button" value="Set Width" onclick="setWidth();">
<input id="txt" type="text" style="width: 50px;" value="100">
</div>
<script>var sel = document.getElementById("sel");
var toolbar = new dhtmlXToolbarObject("toolbarObj");
toolbar.setIconsPath("../common/imgs/");
toolbar.loadXML("../common/dhxtoolbar_input.xml?etc=" + new Date().getTime(), updateList);
function getId() {
var id = sel.options[sel.selectedIndex].value;
return id;
}
function setWidth(text) {
toolbar.setWidth(getId(), document.getElementById("txt").value);
}
function getWidth() {
alert(toolbar.getWidth(getId()));
}
function updateList() {
sel.options.length = 0;
toolbar.forEachItem(function(itemId) {
if (toolbar.getType(itemId) == "buttonInput") {
sel.options.add(new Option(itemId, itemId));
}
});
}
</script>