How to Redirect 10 second Countdown

If you want to redirect page automatically with seconds then you have to put javascript code .code is

<p>Redirected in <span id=”counter”>5</span> second(s).</p>

<script type=”text/javascript”>
function countdown()
{
var i = document.getElementById(‘counter’);
if (parseInt(i.innerHTML)<=0)
{
location.href = ‘login.php’;
}
i.innerHTML = parseInt(i.innerHTML)-1;
}
setInterval(function(){ countdown(); },500); // time duration in miliseconds
</script>

Leave a Reply

Your email address will not be published.