问答详情
源自:8-5 计时器setTimeout()

另外一种写法

<!DOCTYPE HTML>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; 


charset=utf-8">

<title>计时器</title>

</head>

<script type="text/javascript">

  var num=0;

  function startCount() {

    document.getElementById('count').value=num;

    num=num+1;

  }

  setInterval(startCount,1000);

   

</script>

</head>

<body>

<form>

<input type="text" id="count" />

</form>

</body>

</html>


提问者:天天距离 2016-10-23 00:04

个回答

  • 慕勒7123956
    2016-10-23 08:09:31
    已采纳

    嗯(其实我是水回复的)

  • 慕村1994845
    2016-10-24 20:36:09

    其实本节的练习不如例子好,例子可以更好看清setTimeout()与setInterval()的区别