i want to make a 20 seconds countdown timer, when timer comes to zero it refreshes iframe
. and then after refreshing iframe
timer again comes to 20 seconds and after it comes 0 it again refreshes iframe
. how can i do this, i have a js timer script which refreshes the iframe
but i don't know how to make this script run again and again.
<script>
var tT;
var timer=20;
var stop;
$(document).ready(function(){
tT=document.getElementById('timer');
tT.value=timer;
stop=setInterval(function(){
if(timer>0){
timer--;
tT.value=timer;
}else{
clearInterval(stop);
}},1000);
setTimeout(function(){
document.getElementById('timer').value = timer;
document.getElementById('exchanger').src = document.getElementById('exchanger').src;
},20000);
});
</script>
Iframe :-
<input id="timer" value="20" type="text" size="2" readonly style="border:none;background:transparent;width:18px;text-align:center">