Basic Time Keeper
Posted: Thu Oct 29, 2009 11:38 am
I have a simple script that increments every second and displays the total. Is it possible in JavaScript to just take that whole number and format it into time like hh:ii:ss?
Example format the number 120 into 00:02:00
Code: Select all
<script type="text/javascript">
var count = 0;
setTimeout('calculate_count();', 1000);
function calculate_count() {
count++;
document.getElementById('count').value = count;
setTimeout('calculate_count();', 1000);
}
</script>
<input type="text" id="count" value="0" />