How to realize automatic page jump in HTML

How to realize automatic page jump in HTML

1.1 The method
        is to add the <meta> tag directly in the <head></head> tag. code show as below:
<head>
    <meta http-equiv="refresh" content="3;URL=res.html">
    <!-- Automatically jump to the res.html page after 3 seconds-->
</head>

1.2 Method 2
        Use the JS setTimeout function to define an expression to be executed after the specified millisecond value. code show as below:
<script>
setTimeout(function (){
    location.href=" res.html ";
},3000); //Automatically execute the function after 3 seconds, jump directly to the res.html page
</script>

1.3 Method 3
        The defect of the above two examples is that the jump can be realized, but it is not known when to jump. To achieve the inverse 3-2-1, the JS settimeout function cannot do it, and the JS setInterval function needs to be used to define an expression to be executed after the specified millisecond value. code show as below:
<script>
var x=3;//Use global variables to execute
setInterval(function (){
    x--;
    x>0? document.getElementById("info").innerHTML=x : location.href='123.html';
},1000);
</script>


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326498588&siteId=291194637