<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
<script type="text/javascript">
var time;
var i=0;
function c()
{
time=setInterval("d()",1000)
}
function d()
{
(document.getElementById('cd')).value=i++;
}
function f()
{
clearInterval(time);
}
</script>
</head>
<body>
<input id='cd' type ="button" value ="number">
<input type ="button" value ="开始" onclick="c()">
<input type ="button" value ="停止" onclick="f()">
</body>
</html>
点了几次开始,数字就变得快的起来。我知道这是个bug,想知道为什么会越来越快?
希望各位大神说的详细点,新手一枚,谢谢。
ITMISS
相关分类