title: javascript - add milliseconds to counter
body: <p>I would like to know how can i add milliseconds to my JS counter of quiz. At this point the quiz itself only count and look for seconds (in mysql it's a number of seconds, like: 120 (2 minutes), and it's displayed as 02:00). Now i would like to add milliseconds to it. Thanks in advance</p>
  
  <p>Here's the script:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  var quiz_timer = 0;
  
  $(window).load(function(){
  setInterval('run_timer()',1000 )
  })
  
  function run_timer()
  {
  quiz_timer++;
  
  if(quiz_timer &gt; 60)
  {
      sec = quiz_timer%60;
      min = Math.floor(quiz_timer/60);
  }
  else
  {
      sec = quiz_timer;
      min = 0;
  }
  
  var timer='';
  
  if(min &lt; 10)
  timer = '0';
  
  timer += min;
  
  timer += ':';
  
  if(sec &lt; 10)
  timer += '0';
  
  timer += sec;
  
  
  var timer_h = 'Time: '+timer;//+rand();
  $('#quiz_timer').html(timer_h);
  $('#quiz_time').val(quiz_timer);
  }
  
  function update_quiz()
  {
  var cnt_questions = parseInt($('#cnt_questions').val());
  var cq = parseInt($('#current_question').val());
  var op = $('#question_'+cq).find('input[type=radio]:checked').length;
  
  if(op == 0)
  {
      alert('You must answer on the question.');
      return false;
  }
  
  if(cq &lt; cnt_questions)
  {
      $('#question_'+cq).hide();
      $('#question_'+(cq+1)).fadeIn(1000);
      $('#current_question').val(cq+1);
      return false;
  }   
  
  $(window).unbind('beforeunload');
  document.frm_quiz.submit();
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>And here's the function that input the data in mysql:</p>
  
  <pre><code>function timer($quiz_timer)
  {
  if($quiz_timer &gt; 60)
  {
      $sec = $quiz_timer%60;
      $min = floor($quiz_timer/60);
  }
  else
  {
      $sec = $quiz_timer;
      $min = 0;
  }
  
  $timer='';
  
  if($min &lt; 10)
  $timer = '0';
  
  $timer .= $min;
  
  $timer .= ':';
  
  if($sec &lt; 10)
  $timer .= '0';
  
  $timer .= $sec;
  
  return $timer;
  }
  </code></pre>