Js click the button to jump to another new page _ javascript tips

Source: Internet
Author: User
How can I jump to another page by clicking the button? How can I click an image to jump to a new page? You can use the onclickwindow. location new page to realize how to jump to another page by clicking the button? We may need this in website production, because sometimes we need this effect, especially when we make a button into an image and click an image to jump to a new page, how can this problem be achieved?

This effect can be achieved through onclick = "window. location = 'new page.

1. directly jump to the original form using

The Code is as follows:

Window. location. href = "the page you want to jump ";

2. Open the page in the new form:

The Code is as follows:

Window. open ('page you want to jump ');

Window. history. back (-1); return to the previous page

The Code is as follows:

If you want to verify that the input amount is filled in when you click the button to submit, what should you do? When the user name is entered or other fields are empty, click the button to do not submit. You can follow the methods below.

The Code is as follows:

The Code is as follows:


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.