Wednesday, November 20, 2013

JavaScript Count Down Timer



<!-- Javascript Timer Start-->
<span style="font-size:xx-large;font-family: arial;" >
<span id="spMin">00</span>:<span id="spSec">00</span>
</span>
</font>
<script type="text/javascript">
var countSec=0;
var countMin=5;
function UpdatTimer(){
if(countSec<10)
$('#spSec').text('0'+countSec);
else
$('#spSec').text(countSec);
if(countMin<10)
$('#spMin').text('0'+countMin);
else
$('#spMin').text(countMin);

countSec=countSec-1;

if(countSec<=0)
{
countMin=countMin-1;
countSec=59;
}

if(countMin==0)
{
$('#spSec').text('00');
$('#spMin').text('00');
clearInterval(intTimer);
//Timeout do your functionality
}
}
UpdatTimer();
var  intTimer = setInterval(UpdatTimer,1000);
</script>
<!-- Javascript Timer End-->


Shahzad Afzal
http://www.pakistanprobe.com/


No comments:

Popular Posts