Question

Javascript count-up timer not working as expected

I have a count-up timer in javascript. The script counts till 8 seconds and then instead of counting further, it restarts from 1. This does not occur on Chrome. Below is the code:

$(document).ready(function() {
 isTest = false;
 setInterval('showTime()', 1000);
});

function showTime()
{
 var s = parseInt($("#s").text());
 var m = parseInt($("#m").text());
 var h = parseInt($("#h").text());
 s++;
 
 if(s > 59)
 {
  s = 0;
  m++;
  if(m > 59)
  {
   m = 0;
   h++;
  }
 }
 
 if(s < 10)
 {
  s = '0' + s;
 }
 if(m < 10)
 {
  m = '0' + m;
 }
 if(h < 10)
 {
  h = '0' + h;
 }
 
 $("#s").text(s);
 $("#m").text(m);
 $("#h").text(h);
}