Js click the button to jump to another new page, jsbutton

Source: Internet
Author: User

Js click the button to jump to another new page, jsbutton

How can I 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:

<Input type = "submit" name = "Submit" value = "agree" onclick = window. open (http://www.bkjia.com/)>

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:
Copy codeThe Code is as follows:
<Input type = "submit" name = "submit" onclick = "open ()">

<Script language = javascript>
Fuction open (){

If (! Document. form_name.username.value ){

Alert ("Enter the user name! "); Document. form_name.username.focus (); return false;

} Else document. form_name.action = "aaa.htm ";

}
</Script>

In this case, when the value is null, the button will not jump to another page? In this way, the effect is achieved.

JS jump page reference code

The Code is as follows:

First:
<Script language = "javascript" type = "text/javascript">
Window. location. href = "login. jsp? Backurl = "+ window. location. href;
</Script>
Second:
<Script language = "javascript">
Alert ("return ");
Window. history. back (-1 );
</Script>
Third:
<Script language = "javascript">
Window. navigate ("top. jsp ");
</Script>
Fourth:
<Script language = "JavaScript">
Self.location+'top.htm ';
</Script>
Category 5:
<Script language = "javascript">
Alert ("illegal access! ");
Top. location = 'xx. jsp ';
</Script>

===== Jump to other pages through the pop-up selection box in javascript ====
Copy codeThe Code is as follows:
<Script language = "javascript">
<! --
Function logout ()...{
If (confirm ("are you sure you want to log out of your identity? Yes-Select OK, no-select cancel "))...{
Window. location. href = "logout. asp? Act = logout"
}
}
-->
</Script>

===== Jump to other pages through a prompt box in javascript ====
Copy codeThe Code is as follows:
<Script language = "javascript">
<! --
Function logout ()...{
Alert ("are you sure you want to cancel your identity? ");
Window. location. href = "logout. asp? Act = logout"
}
-->
</Script>


How can I have a button in HTML jump to a specified page or action after I click it?

<A href = "path"> <input type = "button"> </input> </a> just expand the tag outside the button.

How to click a button control in ASPNET to jump to another page

Response. Redirect ("page to jump to"); or use Respose. write ("<script> window. loaction. href = 'page to jump to '</script> ");

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.