Overview
I believe many web developers know thatProgramThere are many ways to jump between pages, but effective jumps get twice the result with half the effort. Below are some of the Javascript jump methods I used during the development process, share it with you.
First: directly jump to add Parameters
<Script language = "JavaScript" type = "text/JavaScript">
Window. Location. href = "login. jsp? Backurl = "+ window. Location. href;
</SCRIPT>
Direct jump without parameters:
<SCRIPT> window. Location. href = 'HTTP: // www.baidu.com '; </SCRIPT>
Type 2: return to the previous preview Interface
<Script language = "JavaScript">
Alert ("return ");
Window. History. Back (-1 );
</SCRIPT>
Label nesting:
<A href = "javascript: history. Go (-1)"> return to the previous step. </a>
<A href = "<% = request. servervariables (" http_referer ") %>"> return to the previous step </a>
Third: the frame is not valid when the webpage is redirected...
<Script language = "JavaScript">
Window. navigate ("Top. jsp ");
</SCRIPT>
Type 4: the framework is invalid when you specify the webpage to jump ..
<Script language = "JavaScript">
Self.location+'top.htm ';
</SCRIPT>
Category 5: specify that the webpage is valid for the framework ..
<Script language = "JavaScript">
Alert ("illegal access! ");
Top. Location = 'xx. aspx ';
</SCRIPT>
Method 6: click the button to add an event jump ..
<Input name = "pclog" type = "button" value = "go" onclick = "location. href = 'login. aspx '">
7. open in a new window:
<A href = "javascript:" onclick = "window. open ('login. aspx ', '', 'height = 500, width = 611, scrollbars = Yes, status = Yes')"> open a new window </a>
Application instance:
< Head >
< Script Language = "JavaScript" >
Function Old_page ()
{
Window. Location = " Login. aspx "
}
Function Replace ()
{
Window. Location. Replace ( " Login. aspx " )
}
Function New_page ()
{
Window. Open ( " Login. aspx " )
}
</ Script >
</ Head >
< Body >
< Input Type = "Button" Onclick = "New_page ()" Value = "Open s in new window" />
< Input Type = "Button" Onclick = "Old_page ()" Value = "Backward after redirection" />
< Input Type = "Button" Onclick = "Replace ()" Value = "No backend function after jump" />
</ Body >