Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save KresimirKoncicNeuralab/8023500 to your computer and use it in GitHub Desktop.
Save KresimirKoncicNeuralab/8023500 to your computer and use it in GitHub Desktop.
<p id="timerText">00:00</p>
var countSec = 0;
var countSecStr = "";
var countMin = 0;
var countMinStr = "";
function tickTick()
{
countSec++;
if(countSec%60==0)
{
countSec = 0;
countMin++;
}
if(countSec < 10)
{
countSecStr = "0" + countSec;
}
else
{
countSecStr = countSec;
}
if(countMin < 10)
{
countMinStr = "0" + countMin;
}
else
{
countMinStr = countMin;
}
x.innerHTML = countMinStr + ":" + countSecStr ;
}
setInterval(tickTick,1000);
var x = document.getElementById("timerText");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment