Home >Web Front-end >JS Tutorial >JavaScript implements automatic jump to a page after x seconds_javascript skills

JavaScript implements automatic jump to a page after x seconds_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:44:461404browse

I learned a new technology while watching a video today, that is, when we click "Submit" or "Confirm" on a page, it will automatically jump to a page.
After searching on the Internet, there are many ways to deal with this technology. I only wrote down the three methods I learned in the video:
1. Use a response.sendRedirect("target page.jsp.htm "); to achieve direct jump;
2. Sometimes we need some prompts, such as "It will jump automatically after x seconds. If there is no jump, please click here", you can call Delay Go in Snippets in myeclipse To URL. The following code will be automatically generated:

Copy code The code is as follows:


< !-- Place this in the 'body' section -->
My Delayed Link

Modify this code to:
Copy the code The code is as follows:


3
seconds later Automatically jump, if not, please click the link below
target page


Then it will jump directly after 3 seconds Go to the "Target Page". This method is to set a few seconds to jump and the page will not change during this process. For example, set it to 3 seconds, and then as time changes, 3 turns to 2 and then to 1 until it jumps. Please follow Look at the third method.
3. Modify the code in method 2 to:
Copy the code The code is as follows:


3
Automatically jump after seconds , if it does not jump, please click the link below
topic list


The effect achieved by this method is After clicking submit on the previous page, you will jump to this page. After 3 seconds (this 3 will decrease to 0), you will jump to the target page.
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