Create a simple timer object


/**
 * A Timer object.
 */
function Timer() {
	
	var time = 0;
	$('#timer').html(time);
	
	var timer = window.setInterval(function() {
      time += 1;
      $('#timer').html(time);
	}, 1000);
	
	this.stop = function() {
      clearInterval(timer);
      $('#timer').html(time);
	}
	
}

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.