My Simple problem is Just to show that the time is running out.. For example There are only 10 seconds in the time, Show it in my Webpage that the time is 10.. 9.. 8.. 7.. 6.. 5.. 4.. 3.. 2.. 1.. and thats it.. its very simple.. i dont have an idea in javascript because im more in php codes.. I've tried this script
setInterval(function() {
var timer = $('span').html();
timer = timer.split(':');
var minutes = timer[0];
var seconds = timer[1];
seconds -= 1;
if (minutes < 0) return;
if (seconds < 0 && minutes != 0) {
minutes -= 1;
seconds = 59;
}
else if (seconds < 10 && length.seconds != 2) seconds = '0' + seconds;
if ((minutes < 10) && ((minutes+'').length < 2)) minutes = '0' + minutes;
$('span').html(minutes + ':' + seconds);
}, 1000);
and My html Tag like this
<font face="tahoma" size="2" color="red">
<span>00:10</span>
</font>
But its not working, but in JS fiddle.. it's working i wonder why when i put it in my webpage the 10 seconds is not moving.. Thank you for the help
but in JS fiddle.. it's workingdid you try enclosing the JS within<script></script>tag?$(document).ready(function(){});is missing?