0
How do I make a textbox value get updated each 1 sec (for example)?
In web script
2 ответов
+ 1
Hi! You can use the setInterval method. Here is an example:
<html>
<body>
<form>
<input type="text" id="counter" size="20">
</form>
<script>
var count = 0;
var timerID = setInterval(function(){ updateText(); }, 1000);
function updateText() {
textField=document.getElementById('counter');
textField.value = 'Counter: ' + ++count;
if (count==10) {
clearInterval(timerID);
}
}
</script>
</body>
</html>
0
Thank you very much