Modified from: http://forum.codecall.net/topic/5163...in-javascript/
which you could find with a simple search...
Code:
<!doctype html>
<html>
<head>
<script type="text/javascript">
var Timer;
var TotalSeconds;
function CreateTimer(TimerID, Time) {
Timer = document.getElementById(TimerID);
TotalSeconds = Time;
UpdateTimer()
window.setTimeout("Tick()", 1000);
}
function Tick() {
TotalSeconds -= 1;
if (TotalSeconds > 0) {
UpdateTimer()
window.setTimeout("Tick()", 1000);
} else {
Timer.innerHTML = 'Site (to be) updated';
// change redirected URL on next line and uncomment
// window.location.href = 'http://www.webdeveloper.com';
}
}
function UpdateTimer() {
Timer.innerHTML = 'Site will be updated in: '+TotalSeconds+' seconds';
}
</script>
</head>
<body onload="CreateTimer('timer',10)">
<div id='timer' />
</body>
</html>
Bookmarks