<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 Tooltip" onclick="getTip();">
<input type="button" value="Set Tooltip" onclick="setTip();">
<input id="txt" type="text" value="Current value is: %v">
</div>
<script>var sel,
toolbar;
function doOnLoad() {
sel = document.getElementById("sel");
toolbar = new dhtmlXToolbarObject("toolbarObj");
toolbar.setIconsPath("../common/imgs/");
toolbar.loadXML("../common/dhxtoolbar_slider.xml?etc=" + new Date().getTime(), updateList);
}
function getId() {
var id = sel.options[sel.selectedIndex].value;
return id;
}
function setTip(text) {
toolbar.setItemToolTipTemplate(getId(), document.getElementById("txt").value);
}
function getTip() {
alert(toolbar.getItemToolTipTemplate(getId()));
}
function updateList() {
sel.options.length = 0;
toolbar.forEachItem(function(itemId) {
if (toolbar.getType(itemId) == "slider") {
sel.options.add(new Option(itemId, itemId));
}
});
}
</script>