Countdown 404 page auto jump JS code

 Watson Blog September 18, 2017 09:56:11 JS/jQuery comment five hundred and fifty Reading mode

A dynamic countdown 404 page automatically jumps to JS code. Take WordPress of this blog as an example, add the following code to the 404.php file of the theme.

 Countdown 404 page auto jump JS code

The codes are as follows:

  1. <script? language='javascript'?type='text/javascript'>
  2. ????????? var ? secs?=?6;? //Countdown seconds
  3. ????????? var ? URL;
  4. ????????? function ? Load(url)? {
  5. ????????????? URL?=?url;
  6. ????????????? for ? ( var ? i?=?secs;?i?>=?0;?i--)? {
  7. ????????????????? window.setTimeout('doUpdate('?+?i?+?')',?(secs?-?i)?*?1000);
  8. ?????????????}
  9. ?????????}
  10. ????????? function ? doUpdate(num)? {
  11. ????????????? document.getElementById('ShowDiv').innerHTML?=?'< H2>and<span? style= "color:red" >'?+? Num?+? '</span>Automatically return to the home page in seconds<h2>';
  12. ????????????? if ? (num?==?0)? {? window.location?=?URL;?}
  13. ?????????}
  14. ????</ script>
  15. </head>
  16. <body>
  17. ????< script?language= "javascript" ? type= "text/javascript" >Load( " https://wosn.net " );?// Change the URL to the default homepage you want to jump to</script>
  18. ????< div?id= "ShowDiv" ></div>
  19. </body>

AD Please click here to support Watson's blog!

 Watson Blog
  • This article is written by Published on September 18, 2017 09:56:11
  • This article is collected and sorted by the website of Mutual Benefit, and the email address for problem feedback is: wosnnet@foxmail.com , please keep the link of this article for reprinting: https://wosn.net/608.html

Comment