<script type="text/javascript"> function clock(){ var time=new Date(); document.getElementById("clock").value = time; } var i=setInterval(clock,100); </script></head><body> <form> <input type="text" id="clock" size="50" /> <input type="button" value="Stop" onclick="clearInterval(i)" /> </form></body>输出结果:
3 回答
stone310
TA贡献361条经验 获得超191个赞
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <script type="text/javascript"> function clock(){ var time=new Date(); document.getElementById("clock").value = time; } var i=setInterval(clock,100); </script> </head> <body> <form> <input type="text" id="clock" size="50" /> <input type="button" value="Stop" onclick="clearInterval(i)" /> </form> </body> </html>
HTML的head格式这么写能正常显示吗?我的Chrome可以正常显示
添加回答
举报
0/150
提交
取消