Header Ads

javascript counting timer

var digiclock = "00:00:00";

i = 0;

function timer()
{
var digiformat = "";
if(i>3599)
{
var H = Math.floor(i/3600);
}
else
{
var H = 0;
}

var M = i - (H*3600)

if(M>59)
{
M = Math.floor(M/60)
}
else
{
M = 0
}
var S = i - (M*60)
if(H<10)
{
H = "0"+H;
}
if(M<10)
{
M = "0"+M;
}
if(S<10)
{
S = "0"+S;
}
document.getElementById("").value= H+":"+M+":"+S;

setTimeout('timer()', 1000);


i++;

}

No comments:



Powered by Blogger.