Slider value

Current Value: Value:
Minimal Value: Value: Label:
Maximal Value: Value: Label:
</> Source
<!DOCTYPE html>
<html>
<head>
	<title>Slider value</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>
	<style>
		div#toolbarObj {
			margin-top: 30px;
		}
	</style>
	<script>
		var sel;
		var myToolbar;
		function doOnLoad() {
			sel = document.getElementById("sel");
			myToolbar = new dhtmlXToolbarObject({
				parent: "toolbarObj",
				icons_path: "../common/imgs/",
				xml: "../common/dhxtoolbar_slider.xml",
				onload: updateList
			});
		}
		function getId() {
			var id = sel.options[sel.selectedIndex].value;
			return id;
		}
		function setValue() {
			myToolbar.setValue(getId(), Number(document.getElementById("txt").value));
		}
		function getValue() {
			alert(myToolbar.getValue(getId()));
		}
		function setMinValue() {
			var t = String(document.getElementById("txtmin2").value);
			var v = Number(document.getElementById("txtmin1").value);
			myToolbar.setMinValue(getId(), v, t);
		}
		function getMinValue() {
			alert(myToolbar.getMinValue(getId()));
		}
		function setMaxValue() {
			var t = String(document.getElementById("txtmax2").value);
			var v = Number(document.getElementById("txtmax1").value);
			myToolbar.setMaxValue(getId(), v, t);
		}
		function getMaxValue() {
			alert(myToolbar.getMaxValue(getId()));
		}
		function updateList() {
			sel.options.length = 0;
			myToolbar.forEachItem(function(itemId){
				if (myToolbar.getType(itemId) == "slider") {
					sel.options.add(new Option(itemId, itemId));
				}
			});
		}
	</script>
</head>
<body onload="doOnLoad()">
	<div id="toolbarObj"></div>
	<div style="margin-top: 30px;">
		<table cellspacing="0" cellpadding="2" border="0">
			<tr>
				<td rowspan="3"><select id="sel"></select></td>
				<td style="padding-left: 5px; padding-right: 5px;">Current Value:</td>
				<td>
					<input type="button" value="Get Value" onclick="getValue();">
					<input type="button" value="Set Value" onclick="setValue();">
					Value:
					<input id="txt" type="text" value="50" style="width: 30px;">
				</td>
			</tr>
			<tr>
				<td style="padding-left: 5px; padding-right: 5px;">Minimal Value:</td>
				<td>
					<input type="button" value="Get Value" onclick="getMinValue();">
					<input type="button" value="Set Value" onclick="setMinValue();">
					Value:
					<input id="txtmin1" type="text" value="10" style="width: 30px;">
					Label:
					<input id="txtmin2" type="text" value="Min" style="width: 60px;">
				</td>
			</tr>
			<tr>
				<td style="padding-left: 5px; padding-right: 5px;">Maximal Value:</td>
				<td>
					<input type="button" value="Get Value" onclick="getMaxValue();">
					<input type="button" value="Set Value" onclick="setMaxValue();">
					Value:
					<input id="txtmax1" type="text" value="100" style="width: 30px;">
					Label:
					<input id="txtmax2" type="text" value="Max" style="width: 60px;">
				</td>
			</tr>
		</table>
	</div>
</body>
</html>

Documentation

Check documentation to learn how to use the components and easily implement them in your applications.