<html>
<head>
<script language="JavaScript" type="text/javascript">
var endmessage = "IT'S TIME";
var sec = 0; // set the seconds
var min = 0; // set the minutes
var hour = 0;
function init(){
if (document.getElementById) {
var temp = "";
var res = "<form name='frmtime'>";
var c = 0;
for (c=0; c<24; c++) temp += "<option value="+c+">"+c+"</option>";
res += "<select name='slthours'>"+temp+"</select>";
temp = "";
for (c=0; c<60; c++) temp += "<option value="+c+">"+c+"</option>";
res += "<select name='sltminutes'>"+temp+"</select><input type='button' value='OK' onclick='initCountDown();'></form>";
document.getElementById('theTime').innerHTML = res;
}
}
function initCountDown(){
var minutesbox = document.forms['frmtime'].sltminutes;
var minutes = minutesbox.options[minutesbox.selectedIndex].value;
var hoursbox = document.frmtime.slthours;
var hours = hoursbox.options[hoursbox.selectedIndex].value;
//Set the two dates
var now=new Date();
var after=new Date(now.getFullYear(), now.getMonth(), now.getDay(), hours, minutes);
var diff = new Date(after - now);
sec = diff.getSeconds() + 2;
min = diff.getMinutes();
hour = diff.getHours() - 1;
countDown();
}
function countDown() {
sec--;
if (sec == -01) {
sec = 59;
min = min - 1;
}else if(min == -01){
min = 59;
hour = hour - 1;
}else {
min = min;
}
if (sec<=9) { sec = "0" + sec; }
time = (hour<=9 ? "0" + hour : hour) + ":" + (min<=9 ? "0" + min : min) + ":" + sec;
var now = new Date();
var pmins = now.getMinutes();
var phours = now.getHours();
var pseconds = now.getSeconds();
pmins = (pmins <=9 ? "0" + pmins : pmins);
pseconds = (pseconds <=9 ? "0" + pseconds : pseconds);
phours = (phours <=9 ? "0" + phours : phours);
if (document.getElementById) {
document.getElementById('theTime').innerHTML = time;
document.getElementById('current').innerHTML = phours + ":" + pmins + ":" + pseconds;
}
SD=window.setTimeout("countDown();", 1000);
if (min == '00' && sec == '00' && hour == '00') {
sec = "00";
window.clearTimeout(SD);
if (document.getElementById) {
document.getElementById('theTime').innerHTML = endmessage;
document.getElementById('current').innerHTML = "";
}
}
}
window.onload = init;
// -->
</script>
<style type="text/css">
<!--
.timeClass {
font-family:"Lucida Console";
font-weight:bold;
font-size:200px;
}
-->
</style>
</head>
<body>
<!-- This goes into the BODY of the file -->
<span id="current" style="text-align: center; font-size: 30px; font-family: Arial;"></span>
<br><br><br><br><br><br><table width="100%">
<tr><td width="100%" align="center"><span id="theTime" class="timeClass"></span></td></tr>
</table>
</body>
</html>