User-1404016747 posted
Heres a snippet which will redirect in X seconds with a time left display added.
Change the number passed to the function "startCountdown' found in the body tag to the amount of seconds you want to pass before redirecting the user.
<html>
<head>
<title></title>
<script>
function startCountdown(timeLeft) {
var interval = setInterval( countdown, 1000 );
update();
function countdown() {
if ( --timeLeft > 0 ) {
update();
} else {
clearInterval( interval );
update();
completed();
}
}
function update() {
hours = Math.floor( timeLeft / 3600 );
minutes = Math.floor( ( timeLeft % 3600 ) / 60 );
seconds = timeLeft % 60;
document.getElementById('time-left').innerHTML = '' + hours + ':' + minutes + ':' + seconds;
}
function completed() {
window.location = "http://www.asp.net";
}
}
</script>
</head>
<body onload="startCountdown(20);">
Redirect in <span id="time-left"></span>
</body>
</html>