為什么注釋掉setInterval或者把延遲時(shí)間改到1分鐘,文本框里面的時(shí)間還是每秒都在變化?
如題,這樣一來(lái)感覺(jué)設(shè)置setInterval并沒(méi)有起到什么作用啊。。。。求解
<!DOCTYPE?HTML> <html> <head> <meta?http-equiv="Content-Type"?content="text/html;?charset=utf-8"> <title>定時(shí)器</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>
2016-03-17
同樣注釋setInterval()以后還在自動(dòng)刷新,求解釋
2016-03-16
同樣疑惑
2016-03-12