Skip to content

Instantly share code, notes, and snippets.

@ChristopherDosin
Created April 21, 2015 16:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ChristopherDosin/31c143bb07034e93f419 to your computer and use it in GitHub Desktop.
Save ChristopherDosin/31c143bb07034e93f419 to your computer and use it in GitHub Desktop.
Javascript Countdown
// <b id="show-time">5</b>
<script type="text/javascript">
var settimmer = 0;
$(function(){
window.setInterval(function() {
var timeCounter = $("b[id=show-time]").html();
var updateTime = eval(timeCounter)- eval(1);
$("b[id=show-time]").html(updateTime);
if(updateTime == 0){
window.location = ("redirect.php");
}
}, 1000);
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment