Tutorial: javascript count down redirect

Today i will instruct you how to create simple count down redirect page by javascript.
Here’s a script that actually counts down the seconds until you are redirected


<script type="text/javascript">
var time = 10;
function timeDown(){
if (time > 0){
time--;
document.getElementById('second').innerHTML = (time);
}
if(time == 1) window.location = document.getElementById('link').href;
}
setInterval(timeDown, 1000);
</SCRIPT>

<table border="0">
<tr>
<td>
You have just clicked external link. It will be auto redirect after </td>
<td id="second" width="30">10</td>
<td>second</td>
</tr>
</table>
<div>
<a id="link" rel="nofollow" target="_blank" href="http://tipblog.net">

http://tipblog.net</a>

</div>
Farhamdani

Sharing insights on tech, blogging, and passive income. Follow for more at farhamdani.eu.org!

Drop your comments, but make sure they’re related to the discussion!

I'd be grateful if you could read the Commenting Rules on this blog before posting a comment.

Post a Comment (0)
Previous Post Next Post