Run after HTML code?
-
I have made a countdown time for 48 hours, and as soon as it counts down, it resets. I now need it to run a code on completion and allow it to reset as per the code below.
How can I go about doing that?
Thanks guys, your help is highly appreciated.
The Countdown Code:
<script type = "text/javascript"> var timeInSecs; var ticker; function startTimer(secs) { timeInSecs = parseInt(secs); ticker = setInterval("tick()", 1000); } function tick( ) { var secs = timeInSecs; if (secs > 0) { timeInSecs--; } else { clearInterval(ticker); startTimer(172800); // start again } var hours= Math.floor(secs/3600); secs %= 3600; var mins = Math.floor(secs/60); secs %= 60; var pretty = ( (hours < 10 ) ? "0" : "" ) + hours + ":" + ( (mins < 10) ? "0" : "" ) + mins + ":" + ( (secs < 10) ? "0" : "" ) + secs; document.getElementById("countdown").innerHTML = pretty; } startTimer(172800); // 48 hours in seconds
The code I need to run after the 48 hours has passed then reset as per above:
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Run after HTML code?’ is closed to new replies.