Simple Heartbeat Timer

//----- HEARTBEAT TIMER -----
function heartbeat_timer_tick() {

setInterval('heartbeat_timer_tick()', 1000 );		 //Time in mS

Note that if the web browser tab is put in the background values of setInterval < 1000 will be changed to 1000 by browsers such as chrome to improve performance for the active tab.

A Timer You Can Stop

//----- TIMER -----
var my_timer_count = 10;
var my_timer = setInterval('my_timer_tick()', 1000);		 //Time in mS

function my_timer_tick() {
	my_timer_count = my_timer_count - 1;
	if (my_timer_count <= 0)
		document.getElementById('my_message').innerHTML = "Competed";
		clearInterval(my_timer);		//Stop the timer
	document.getElementById('my_message').innerHTML = "Seconds to go: " + my_timer_count;



We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.


Your email address will not be published.