问答详情
源自:8-3 计时器setInterval()

这个应该正确

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>定时器</title>
<script type="text/javascript">
  var attime;
  function clock(){
    var time=new Date();         
    attime=time.toLocaleString();
    document.getElementById("clock").value = attime;
  }
  window.setInterval("clock()",100);
</script>
</head>
<body>
<form>
<input type="text" id="clock" size="50"  />
</form>
</body>
</html>

提问者:qq_干脆面_cnsIST 2018-10-15 22:36

个回答