JS Jump Page Method

Source: Internet
Author: User

<span id= "Tiao" >3</span><a href= "Javascript:countdown" ></a> pudding footprints, seconds after automatic jump ... <meta Http-equiv=refresh content=3;url= '/search/billsearch.jsp ' </ul>

<!--script Start-up
<script language= "javascript" type= "" >
function Countdown (secs) {
Tiao.innertext=secs;
if (--secs>0)
SetTimeout ("Countdown (" +secs+ ")", 1000);
}
Countdown (3);
</script>
<!--end of script--

Button type:

<input name= "Pclog" type= "button" value= "GO" onclick= "location.href= ' http://www.ddhbb.com/'" >

LINK Type:

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

<a href= "<%=request.servervariables (" Http_referer ")%>" > Back to Previous </a>

Direct Jump Type:

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

Open a new window:

<a href= "javascript:" onclick= "window.open (' http://www.ddhbb.com/blog/guestbook.asp ', ', ' height=500,width=611 , Scrollbars=yes,status=yes ') "> Pudding footprints </a>

JS jump page reference Code
The first type:
<script language= "javascript" type= "Text/javascript" >
window.location.href= "Login.jsp?backurl=" +WINDOW.LOCATION.HREF;
</script>
The second type:
<script language= "JavaScript" >
Alert ("return");
Window.history.back (-1);
</script>
The third type:
<script language= "JavaScript" >
Window.navigate ("top.jsp");
</script>
The fourth type:
<script language= "JavaScript" >
self.location= ' top.htm ';
</script>
The fifth type:
<script language= "JavaScript" >
Alert ("Illegal access! ");
top.location= ' xx.jsp ';
</script>

=====javascript pop-up selection box jumps to other pages =====
<script language= "JavaScript" >
<!--
function logout () ... {
if (Confirm ("Are you sure you want to unregister your identity?") Yes-Select OK, no-select Cancel ") ... {
window.location.href= "Logout.asp?act=logout"
}
}
-
</script>

=====javascript pop-up box jumps to other pages =====
<script language= "JavaScript" >
<!--
function logout () ... {
Alert ("Are you sure you want to unregister your identity?") ");
window.location.href= "Logout.asp?act=logout"
}
-
</script>

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

    1. <mce:script type=text/javascript><!--  
    2. if (typeof swfobject = = "Unde Fined ") {   
    3. document.write (' <scr ' + ' IPT type= ' text/javascript ' src= '/scripts/ Swfobject-1.5.js "></scr ' + ' ipt> ');}   
    4. //--></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

    1. <mce:script language= "JavaScript" ><!--  
    2. function Myrefresh ()  & nbsp; 
    3. {   
    4.        window.location.reload (); nbsp;  
    5. }   
    6. setTimeout (' Myrefresh () ', 1000);//Specify 1-second refresh once  
    7. --></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

    1. <body onload= "opener.location.reload ()" > Windows refresh    
    2. <body onunload= " Opener.location.reload () > Refresh when off    
    3. <mce:script language= "JavaScript" > <!--  
    4. window.opener.document.location.reload ()    
    5. //--& Gt;</mce:script>

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.