Skip to content

Instantly share code, notes, and snippets.

@Ajaxsoap
Created March 12, 2018 06:39
Show Gist options
  • Save Ajaxsoap/62a737288e342fd83310904f49446181 to your computer and use it in GitHub Desktop.
Save Ajaxsoap/62a737288e342fd83310904f49446181 to your computer and use it in GitHub Desktop.
<h3>
Redirecting to google.com.com after <span id="countdown">20</span> seconds
</h3>
<script type="text/javascript">
var seconds = 20;
function countdown() {
seconds = seconds - 1;
if (seconds < 0) {
window.location = "https://google.com";
} else {
document.getElementById("countdown").innerHTML = seconds;
window.setTimeout("countdown()", 2000);
}
}
countdown();
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment