216
2016-11-01 10:38:30
0
<script>
var numberValue = 1;
var inter = null;
function start(){
inter = setInterval(numberUp, 300);
}
function numberUp(){
if(numberValue >= 100){
numberValue = 1;
}else{
numberValue++;
}
document.getElementById("number_value").value = numberValue;
}
function stop(){
alert(document.getElementById("number_value").value);
clearInterval(inter);
}
</script>
</head>
<body>
<input type="text" id="number_value" value="" readonly="readonly" />
<br>
<input type="button" onclick="start();" value="Start" />
<input type="button" onclick="stop();" value="Stop" />
</body>