SoFunction
Updated on 2025-03-10

js implementation code to jump page after 3 seconds

How many seconds will it automatically jump to other pages (js script)

Method 1:

Add js between <head></head>

Copy the codeThe code is as follows:

<script language="javascript">
var secs = 3; //Countdown seconds
var URL ;
function Load(url){
URL = url;
for(var i=secs;i>=0;i--)
{
   ('doUpdate(' + i + ')', (secs-i) * 1000);
}
}
function doUpdate(num)
{
('ShowDiv').innerHTML = 'It will automatically jump to the home page after '+num+' seconds';
if(num == 0) { = URL; }
}
</script>

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

Add <div >/div> between <body></body>

Method 2:

Copy the codeThe code is as follows:

<p style="text-indent: 2em; margin-top: 30px;">
The system will automatically jump to the new URL after <span>5</span> seconds. If the jump fails, <a href="https://" title="click to access">Please click</a>. </p>
<script type="text/javascript">  
    delayURL();   
    function delayURL() {
        var delay = ("time").innerHTML;
 var t = setTimeout("delayURL()", 1000);
        if (delay > 0) {
            delay--;
            ("time").innerHTML = delay;
        } else {
     clearTimeout(t); 
            = "https://";
        }       
    }
</script>