Question : Need timmer code in java script

I have time value in post like :
$ti=$_POST['ti']

and assume $ti equal to 5 min

i need some code which continuous show decreasing time like:
4.59 min after second 4.58 ........ so on

i have some code but it shows time in seconds and use input field...
please help..

Answer : Need timmer code in java script

Sorry, logic error in previous code. Use this:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script type="text/javascript">
//<![CDATA[
var time = null;
window.onload = function() {
	timerDisplay = document.getElementById('timer');
	time = parseFloat(timerDisplay.innerHTML);
	time = isNaN(time)?5:time; // default time
	timerDisplay.innerHTML = time.toFixed(2).replace('.', ':');
	setInterval(countdown, 1000);
}
function countdown() {
	if(time > 0.01) {
		time -= 0.01;
		if(time%1 > 0.59) time = Math.floor(time) + 0.59;
		timerDisplay.innerHTML = time.toFixed(2).replace('.', ':');
	} else timerDisplay.innerHTML = "0:00";
}
//]]>
</script>
</head>

<body>
Time left: <span id="timer"><?= $ti ?></span>
</body>
</html>
Random Solutions  
 
programming4us programming4us