Jump to the home page at the specified time in the error page through JS

Jump to the home page at the specified time in the error page through JS

<!DOCTYPE html>
<html>
 <head>
  <title>Browser Object</title>  
  <!-- Jump to the home page at the specified time in the error page through JS-->
  <meta http-equiv="Content-Type" content="text/html; charset=gkb"/>   
 </head>
 <body>
  <!--Write the page layout first-->
  <h3>Successful operation</h3>
  <p>
      Return to home page after <b id="second">5</b> seconds <a href="javascript:goBack();">back</a>
  </p>
 
  <script type="text/javascript">  
   //Get the element that displays the seconds, and use the timer to change the seconds.
  var sec = document.getElementById("second");
  var i = 5;
  var timer = setInterval (function () {
      i--;
      sec.innerHTML = i;   
      if(i ==1){
          window.location.href="http://baidu.com";
      }
  },1000)
  
   / / Control the jump of the web page through the location and history objects of the window.
   function goBack(){
       window.history.go(-1);
   }
 </script>
</body>
</html>

Guess you like

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