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>