JavaScript countdown jump to specified URL address

Source: Internet
Author: User

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>&nbsp;</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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.