Sliders
Sliders are easy, once you have grasped the concept of callback functions.
A slider is declared as:
s = new slider(length, start,end,interval,title)
s.showAt(left,top)
In
two sliders are shown with different value ranges.
These sliders don't do anything, so in
functions are assigned to the sliders.
This works the same as in the Zoom/Pan examples: to each slider are
assigned two callback functions with "setMoveFunc()" and "setStopFunc()"
These functions are executed when a slider is dragged and
when the mouse is released. Each function gets passed
the slider object that triggered it, so the slider's actual value can be
read by the
slider method "getValue()" and put into the text field. Note that
the text fields have also been created in JavaScript. In fact
the following pieces of code are completely equivalent:
<input type=text id=inpId>
<script>
inp = document.getElementById("inpId")
</script>
and
inp = document.createElement("input")
inp.setAttribute("type","text")
document.body.appendChild(inp)
Personally I prefer to create all interactive elements in pure JavaScript
and to use HTML only for static text.