- <html>
- <head>
- <title> Nonove js timer 计时器 </title>
- </head>
- <body>
- <script language="javascript">
- var se,m=0,h=0,s=0,ss=1;
- function second(){
- if((ss%100)==0){s+=1;ss=1;}
- if(s>0 && (s%60)==0){m+=1;s=0;}
- if(m>0 && (m%60)==0){h+=1;m=0;}
- t=h+"时"+m+"分"+s+"秒"+ss+"毫秒";
- document.getElementById("showtime").value=t;
- ss+=1;
- }
- function startclock(){se=setInterval("second()",1);}
- function pauseclock(){clearInterval(se);}
- function stopclock(){clearInterval(se);ss=1;m=h=s=0;}
- </script>
- <input name="s" type="button" value="开始计时" onclick="startclock()">
- <input name="s" type="button" value="暂停计时" onclick="pauseclock()">
- <input name="s" type="button" value="停止计时" onclick="stopclock()">
- <input name="showtime" style="color:#ff0000;width:200px;" id="showtime" type="text" value="0时0分0秒">
- </body>
- </html>