JS Countdown end jump to the specified URL, looks like the countdown and no difference, just a jump function, originally thought this function is too simple, not worth sending, but yesterday happened to have a person asked me this question, the index of the code sent up at that time, may help more JavaScript novice bar, The code is as follows:
JavaScript code:
| The code is as follows |
Copy Code |
Function times () { for (i=4;i>0;i++) { SetTimeout (' relink () ', 1000);//1 seconds after execution } } function Relink () { Window.sarea.innerText = i;//Inserts a number of seconds at a specific location if (i = = 0) { location.href=url;//the URL of the jump after the end Return } else times (); } |
URL to use the time to add double quotes, like this:
| The code is as follows |
Copy Code |
Location.href= "Http://www.111cn.net"; |
Below share your previous 404 error page Features
| The code is as follows |
Copy Code |
<script language=javascript> function Countdown (Secs,surl) { Content values displayed in the document.getElementById (' Tiao ') .innertext=secs;//<span> if (--secs>0) { SetTimeout ("Countdown" ("+secs+", "+surl+") ", 1000);/Set timeout time } else{
location.href=surl;//Jump Page } } </script> |
HTML code
| The code is as follows |
Copy Code |
| <table width=650 border=0 align= "center" cellpadding=8 cellspacing=0> <tr> <TD align=center><div align= "left" ><font face=arial size=+1><b> Sorry, the page you are trying to access does not exist. <span id= "Tiao" >5</span> seconds will automatically jump to the home page <script Language=javascript>countdown (5, ' http:// Www.111cn.net ');</script><br> <br> </b></font></div></td> </tr> <tr> <TD class= "P1" style= "Text-align:left;" > <ol> <li> Please check that the URL you entered is correct. </li> <li> If you are unable to confirm your input URL, please visit the Mobile Theme website <a title= ' mobile theme ' > Mobile theme </a>, or <a title= ' wap phone theme ' >wap Mobile theme </a > page to view the URLs you want to visit. </li> <li> Enter the content to be accessed directly to search: </ol></td> </tr> <tr> <td> </td> </tr> <tr> <TD class= "F12" ><span class= "P1" > If there is any doubt .... I don't know how to be good </span></td> </tr> <tr> <td><div align= "right" ></div></td> </tr> </table> |
The effect is as follows