如题,这样一来感觉设置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(); var s=time.getSeconds(); if(s<10){ s="0"+s; } attime=time.getHours()+":"+time.getMinutes()+":"+s; document.getElementById("clock").value = attime; } var timer=setInterval(clock,1000*60); </script> </head> <body> <form> <input type="text" id="clock" size="50" style="width:60px;background-color:black;color:white;"/> </form> </body> </html>
同样注释setInterval()以后还在自动刷新,求解释
同样疑惑
这是所有的代码吗?