when the webpage loads there are two input fields, this is seconds and tenths of seconds..the user can type the required value into these..
but instead of counting down it actually counts up... i want to be able to put in the required values, hit the button and have it count down to 0.
the other thing is, i need it working in hours and mins rather than seconds and tenths of seconds...
im thinking i need to alter the setTimeout values for this, but im really not sure...
would much appreciate any help anyone can give...
thanks..
this is the code:
- Code: Select all
var timer1;
var sds =0;
var stop = false;
Count();
function Count()
{
sds = document.countdown.counter.value;
document.countdown.counter.value= parseInt(sds)+1;
document.countdown.countmilli.value= 0;
if(timer1)
{
clearTimeout(timer1);
clearTimeout(timer2);
}
if(stop == false)
{
timer2= setTimeout('CountMilli()', 100);
timer1= setTimeout('Count()', 995);
}
}
function CountMilli()
{
sds = document.countdown.countmilli.value;
document.countdown.countmilli.value= parseInt(sds)+1;
if(timer2)
{
clearTimeout(timer2);
}
if(stop == false)
{
timer2= setTimeout('CountMilli()', 100);
}
}
function stopper()
{
if(timer1)
{
clearTimeout(timer1);
clearTimeout(timer2);
}
stop=true;
}
function starter()
{
if(timer1)
{
clearTimeout(timer1);
clearTimeout(timer2);
}
stop=false;
timer1= setTimeout('Count()', 995);
}
function new1()
{
if(timer1)
{
clearTimeout(timer1);
clearTimeout(timer2);
}
stop=false;
document.countdown.counter.value= 0;
document.countdown.countmilli.value=0;
timer1= setTimeout('Count()', 1000);
timer2= setTimeout('CountMilli()', 100);
}


