Home > Web Front-end > JS Tutorial > js click button button to jump to another new page_javascript skills

js click button button to jump to another new page_javascript skills

WBOY
Release: 2016-05-16 16:34:24
Original
1735 people have browsed it

How to jump to another page by clicking the button? We may need it in website production, because sometimes we need to achieve such an effect, especially when the button is made into a picture, and when clicking the picture to jump to a new page, how to do it?

Such an effect can be achieved by: onclick="window.location='new page'".

1. Use

to jump directly in the original form

The code is as follows

window.location.href="The page you want to jump to";

2. To open the page in a new form:

The code is as follows

window.open('The page you want to jump to');

window.history.back(-1); Return to the previous page

The code is as follows

What should you do if you want to verify whether the input is filled in when you click the button to submit? When the user name is entered or other fields are empty, if you click the button without submitting, you can do it as follows.

The code is as follows

Copy code The code is as follows:



In this case, when the value is empty, clicking the button will still not jump to another page? This achieves the effect.

JS jump page reference code

The code is as follows

First type:

The second type:

The third type:

The fourth type:

The fifth type:

=====The pop-up selection box in javascript jumps to other pages=====

Copy code The code is as follows:



=====The pop-up prompt box jumps to other pages in javascript=====
Copy code The code is as follows:


Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template