The following JavaScript code is used create countdown timer for one minute.
<html>
<head>
<title>CountDown Timer</title>
</head>
<body>
<div style="font-family:'Courier New'; font-size: 16px; text-align: center;">
Remaining Time <span id="TimerZone"></span>
</div>
<script type="text/javascript">
var mins=01, secs=00;
document.getElementById('TimerZone').innerHTML = mins+" : "+secs;
TimeRunner();
function TimeRunner(){
if(secs==0){
mins = mins-1;
secs = 59;
}else{
secs = secs - 1;
}
if(mins==0 && secs>30)
document.getElementById('TimerZone').innerHTML = mins+" : "+secs;
if(mins==0 && secs<=30)
document.getElementById('TimerZone').innerHTML = "<font color='red'>"+mins+" : "+secs+"</font>";
if(mins==0 && secs==0){
return ;
}
setTimeout(TimeRunner,1000);
}
</script>
</body>
</html>
<head>
<title>CountDown Timer</title>
</head>
<body>
<div style="font-family:'Courier New'; font-size: 16px; text-align: center;">
Remaining Time <span id="TimerZone"></span>
</div>
<script type="text/javascript">
var mins=01, secs=00;
document.getElementById('TimerZone').innerHTML = mins+" : "+secs;
TimeRunner();
function TimeRunner(){
if(secs==0){
mins = mins-1;
secs = 59;
}else{
secs = secs - 1;
}
if(mins==0 && secs>30)
document.getElementById('TimerZone').innerHTML = mins+" : "+secs;
if(mins==0 && secs<=30)
document.getElementById('TimerZone').innerHTML = "<font color='red'>"+mins+" : "+secs+"</font>";
if(mins==0 && secs==0){
return ;
}
setTimeout(TimeRunner,1000);
}
</script>
</body>
</html>