Several ways that JavaScript implements page jumps

Source: Internet
Author: User

Overview

I believe a lot of web developers know, in the development of the Web program, the page between the jump, there are many kinds of, but effective jump is less, the following is my usual development process used in some JavaScript jump way, take out and share with you.

The first type: direct jump plus parameter

    <script language= "javascript" type= "Text/javascript" >

</script>

Direct Jump without parameters:

<script>window.location.href= ' http://www.baidu.com ';</script>



Second: Return to the previous preview screen

<script language= "JavaScript" >
Alert ("return");
Window.history.back (-1);
</script>


Tag nesting:

<a href= "Javascript:history.go ( -1)" > Back to Previous </a>
<a href= "<%=request.servervariables (" Http_referer ")%>" > Back to Previous </a>



The third type: Specifies that the jump page is not valid for the frame ...

   <script language= "JavaScript" >
Window.navigate ("top.jsp");
</script>



The fourth type: Specifies that the jump page is not valid for the frame ...

   <script language= "JavaScript" >
self.location= ' top.htm ';
</script>



The fifth type: Specify that the jump page is valid for the frame ...

   <script language= "JavaScript" >
Alert ("Illegal access! ");
top.location= ' xx.aspx ';
</script>

The Sixth Type: Button button to add event jump

<input name= "Pclog" type= "button" value= "GO" onclick= "location.href= ' Login.aspx '" >


  

The seventh type: opens in a new window:


 

Application Examples:


<script language= "JavaScript" >



















</body>

Several ways that JavaScript implements page jumps

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.