A Pen by Captain Anonymous on CodePen.
Created
December 18, 2013 14:44
-
-
Save anonymous/8023461 to your computer and use it in GitHub Desktop.
A Pen by Anonasaurus Rex.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p id="timerText">00:00</p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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