JS Way of Page jump
1.window.location.href Way
<script language= "javascript" type= "Text/javascript" >
Window.location.href= "Target.aspx";
</script>
2.window.navigate Way Jump
<script language= "JavaScript" >
Window.navigate ("target.aspx");
</script>
3.window.loction.replace way to achieve page jump, note the difference from the first way
<script language= "JavaScript" >
Window.location.replace ("target.aspx");
</script>
There are 3 JSP pages (1.aspx, 2.aspx, 3.aspx), into the system default is 1.aspx, when I enter 2.aspx, 2.aspx inside with Window.location.replace ("3.aspx");
With the use of Window.location.href ("3.aspx");
There is no difference from the user interface, but when the 3.aspx page has a "back" button, call Window.history.go (-1); Wondow.history.back () method, a little bit of this return button will return to the 2.aspx page, the difference is out, when using Window.location.replace ("3.aspx"); On the 3.aspx page, call Window.history.go ( -1) in the 3.aspx page, Wondow.history.back (), and the method is not good enough to return to 1.aspx.
4.self.location way to achieve page jump, and the following top.location there is a small difference
<script language= "JavaScript" >
self.location= ' target.aspx ';
</script>
5.top.location
<script language= "JavaScript" >
top.location= ' target.aspx ';
</script>
6. Do not recommend this way to jump
<script language= "JavaScript" >
Alert ("return");
Window.history.back (-1);
</script>
Meta-mode implementation jump (Content = 3 units is seconds)
<meta Http-equiv=refresh content=3; Url= "Http://www.dayanmei.com" >
Summary two:
1. Javascript returns to previous page History.go (-1), returns two pages: History.go (-2);
2. History.back ().
3. Window.history.forward () return to next page
4. Window.history.go (return to page or use the URL you have visited)
Cases:
<a href= "Javascript:history.go (-1);" > Up one page </a>
Response. Write ("<script language=javascript>")
Response. Write ("if (!confirm (' Complete task? ')") {History.back ();} ")
Response. Write ("</script>")
Response. Write ("<script language=javascript>history.go ( -1);</script>")
<a href= "Javascript:history.go (-1);" > Up one page </a>
Page Jump: onclick= "window.location.href= ' list.aspx '"
P.S.
Small tricks (JS reference js):
[JavaScript]View Plaincopy
- <mce:script type=text/javascript><!--
-
- if (typeof swfobject == "undefined") {
- document.write ( ' <SCR ' + ' ipt type= "text/ JavaScript " src="/scripts/swfobject-1.5.js "></scr ' + ' ipt> ');}
- // --></mce:script>
JavaScript refreshes the page in several ways:
1 history.go (0)
2 Location.reload ()
3 location=location
4 Location.assign (location)
5 Document.execcommand (' Refresh ')
6 Window.navigate (location)
7 Location.replace (location)
8 document. Url=location.href
Ways to automatically refresh pages:
1. Automatic page refresh: Add the following code to the <meta http-equiv= "Refresh" content= ">"
20 refers to a refresh of the page every 20 seconds.
2. Page Auto-jump: Add the following code to the <meta http-equiv= "Refresh" content= "20;url=http://www.wyxg.com" >
Where 20 means jump to http://www.wyxg.com page after 20 seconds
3. Page automatically refresh JS version
[C-sharp]View Plaincopy
- <mce:script language="JavaScript" ><!--
- function Myrefresh ()
- {
- Window.location.reload ();
- }
- SetTimeout (' Myrefresh () ', 1000); //Specify 1 seconds to refresh once
- --></mce:script>
ASP. NET how to Output Flush parent window script statements
1. This.response.write ("<script>opener.location.reload ();</script>");
2. This.response.write ("<script>opener.window.location.href = opener.window.location.href;</script>") ;
3. Response.Write ("<script language=javascript>opener.window.navigate (" You want to refresh the page. asp ');</script> ")
JS Refresh Framework Script statement
How to refresh the page that contains the frame
<script language=javascript>
Parent.location.reload ();
</script>
child window refreshes parent window
<script language=javascript>
Self.opener.location.reload ();
</script>
(or <a href= "javascript:opener.location.reload ()" > Refresh </a>)
How to refresh another frame's page with
<script language=javascript>
Parent. Another FrameID.location.reload ();
</script>
Call the following statement in <body> if you want to refresh the window or refresh it when you want to open it.
[JavaScript]View Plaincopy
- <body onload="opener.location.reload ()" > Windows refresh
- <body onunload="opener.location.reload ()" > Refresh when off
- <mce:script language="javascript" ><!--
- Window.opener.document.location.reload ()
- --></mce:script>
Reference: http://blog.csdn.net/kongjing0815/article/details/5808063