這樣寫錯了嗎
<!DOCTYPE?HTML> <html> <head> <meta?http-equiv="Content-Type"?content="text/html;?charset=utf-8"> <title>計時器</title> <script?type="text/javascript"> ???function?clock(){ ??????var?time=new?Date();??????????????? ?? ??????document.getElementById("clock").value?=?time; ???} ?????var?i=setInterval("clock()",1000); </script> </head> <body> ??<form> ????<input?type="text"?id="clock"?size="50"??/> ????<input?type="button"?value="Stop"?onclick="clearInterval(i)"?/> ??</form> </body> </html>
為什么我在本地打開就可以?是慕課的問題還是我的代碼有問題
2015-10-15
代碼是沒有錯的 ,可能你寫代碼的時候慕課網(wǎng)出現(xiàn)了問題,現(xiàn)在我已經(jīng)檢查過了 是可以的
2015-10-04
腳本位置放在body之后