JS 3 seconds after the jump page implementation code _ time and date

Source: Internet
Author: User

The number of seconds after the automatic jump to other pages (JS script)

Method One:

To add JS between

Copy Code code as follows:

<script language= "JavaScript" >
var secs = 3; Number of seconds to Countdown
var URL;
function Load (URL) {
url = URL;
for (Var i=secs;i>=0;i--)
{
Window.settimeout (' doupdate (' + i + ') ', (secs-i) * 1000);
}
}
function doupdate (num)
{
document.getElementById (' Showdiv '). InnerHTML = ' will automatically jump to home page ' after ' +num+ ' seconds;
if (num = = 0) {window.location = URL;}
}
</script>

Then in <body> add <body onload= "Load (' index.asp ')" > index.asp for the page you want to jump.

Between <body></body> plus <div id= "Showdiv" ></div>

Method Two:

Copy Code code as follows:

<p style= "TEXT-INDENT:2EM; margin-top:30px; " >
The system will automatically jump to the new URL after <span id= "time" >5</span> seconds, if it fails to jump, <a href= "http://www.jb51.net" title= "click access" > Please click </a>. </p>
<script type= "Text/javascript" >
Delayurl ();
function Delayurl () {
var delay = document.getElementById ("Time"). InnerHTML;
var t = settimeout ("Delayurl ()", 1000);
if (Delay > 0) {
delay--;
document.getElementById ("Time"). InnerHTML = delay;
} else {
Cleartimeout (t);
Window.location.href = "Http://www.jb51.net";
}
}
</script>

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.