Hi there jpalmes,
here is a possible example...
Code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>simple countdown</title>
<style>
form {
text-align:center;
}
input {
font-family:'courier new',monospace;
font-size:18px;
font-weight:bold;
text-align:center;
background-color:#f0f0f0;
box-shadow: 5px 5px 5px #999;
}
</style>
<script>
/*** these values are editable ***/
var sec=30;
var min=7;
/********************************/
var m=0;
var z='';
var z1='';
if(sec<=10){
zero='0';
}
if(min<10){
zero1='0';
}
var t=z1+min+':'+z+sec+':'+m+'0';
m++;
function display(){
if(m<=0){
m=10;
sec--;
}
if(sec<10){
z='0';
}
if(sec<0){
sec=59;
z='';
min--;
}
if(min<10){
z1='0';
}
m--
document.forms[0][0].value=z1+min+':'+z+sec+':'+m+'0';
if((min<=0)&&(sec==0)&&(m==0)){
setTimeout(function(){document.forms[0][0].value=t},1000);
return;
}
setTimeout(function(){display()},100);
}
window.addEventListener?
window.addEventListener('load',display,false):
window.attachEvent('onload',display);
</script>
</head>
<body>
<form action="#">
<div>
<input type="text" size="12">
</div>
</form>
</body>
</html>
coothead
Bookmarks