View Single Post
  #3 (permalink)  
Old 04-03-2008, 09:16 PM
alilg's Avatar   
alilg alilg is offline
Newbie
 
Join Date: Apr 2008
Location: Ultramarine
Age: 22
Posts: 16
Rep Power: 3
alilg is on a distinguished road
Send a message via AIM to alilg Send a message via Yahoo to alilg Send a message via Skype™ to alilg
Default Re: Help for making clock for time counter

and i now i changed the above code to make a
digital clock with this format "00:00:00"

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Digitl clock</title>
</head>
<body onload="timer()">

<style type="text/css">
#time{
font-size:50pt;
}
</style>

<script type="text/javascript">
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('time').innerHTML = H+":"+M+":"+S;
    setTimeout('timer()', 1000);
    i++;
}

</script>

<div id="time">90</div>


</body>
</html>
__________________
my free software and games
Reply With Quote