@renan already posted a good solution (and already took my +1), I'll leave here a similar alternative, with a few differences in the syntax and methods used:
<input type="range" name="vol" value="0" min="0" max="100"
oninput="display.value=value" onchange="display.value=value">
<input type="text" id="display" value="0" readonly>
- The
oninput
property calls a JS function, and is usually "realtime", but is less compatible than using onchange
(eg IE does not work).
-
onchange
works in more browsers , but it is not in all that it updates in realtime, so we use both simultaneously.
Of curiosity, you can make it work in two ways. Editing the text field, the slider accompanies it. By moving the slider, the text field accompanies:
<input type="range" id="vol" name="vol" value="0" min="0" max="100"
oninput="display.value=value" onchange="display.value=value">
<input type="text" id="display" value="0"
oninput="vol.value=value" onchange="vol.value=value">