<html>
  <script>
   var stop;
var ss=0;
var s=0;
var m=0;
var h=0;
function  clock(){
var btn = document.getElementById('start');
switch(btn.value){
case "start":
setTimeout("init()",10);
btn.value = "pause";
break;
case 'pause':
clearTimeout(stop);
btn.value = "start";
alert(document.getElementById("showtime").value);
break;
  }
}
function init(){
  ss++;
  var show =document.getElementById("showtime");
  if(m==60){
   h++;m=0;
  }
  if(s==60){
   m++;s=0;
  }
  if(ss==100){
   s++;ss=0;
  }
  if(m<10&&s<10){
  show.value= "0"+h+":"+"0"+m+":"+"0"+s+":"+ss;
  }
  else if(s<10&&m>=10){
  show.value= "0"+h+":"+m+":"+"0"+s+":"+ss;
  }else if(m<10&&s>=10){
  show.value="0"+h+":"+"0"+m+":"+s+":"+ss;
  }
  else show.value= "0"+h+":"+m+":"+s+":"+ss;
  stop=setTimeout("init()",10);
  }
 function reset(){
h=0;
m=0;
s=0;
ss=0;
document.getElementById("showtime").value="00:00:00:00";
clearTimeout(stop);
var btn = document.getElementById('start');
btn.value = "start";
}
  </script>
  <body onLoad="reset();">
  <input type="text" id="showtime" name="showtime"/> 
    <input type="button" onclick="clock();" id="start" name="start"  value="start"/>
    <input type="button" onclick="reset();" id="reset" name="reset"  value="reset"/> 
    <div id="01">  
     
    </div>
  </body>
</html>
代码写的差不多了,但是还想实现每次暂停后自动记录下暂停的时间,求解!希望大虾们赐教