Home  >  Article  >  Daily Programming  >  How to implement countdown jump page in js

How to implement countdown jump page in js

藏色散人
藏色散人Original
2018-11-17 17:17:0311996browse

This article mainly introduces to you the js method to achieve the countdown jump page effect.

The effect of countdown page jump must have been encountered by everyone when browsing major websites. It is mainly to make using the web page more user-friendly.

Below we will use specific code examples to explain how to use js to implement countdown to jump to a new page.

js implementation of countdown jump codeThe example is as follows:




    
    页面跳转
    

还剩5秒跳转至php中文网

In the js part of the above code, first we obtain the span tag object through the getElementsByTagName method, and then define a variable i, where i is time. Then use the if statement to first determine whether i is greater than 0. If it is greater than 0, insert the content i through the innerHTML method. Otherwise, jump to the page "//m.sbmmt.com", and finally use the setInterval() method to call fuc( )function.

Then the final countdown jump effect achieved by the front desk is as follows:

How to implement countdown jump page in js

This article is about js implementing the countdown jump page The effect method introduction of has certain reference value. I hope it will be helpful to friends in need!

The above is the detailed content of How to implement countdown jump page in js. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn