Home >Web Front-end >JS Tutorial >js click button button to jump to another new page_javascript skills
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 formThe 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
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=====