var time = document.getElementById('time'); var second = time.innerHTML; setInterval(function(){ time.innerHTML = second--; if(second == 0){ window.location.href="http://892.alloprepaid.com/"; } }, 1000);