JS timed Refresh page and jump page

Source: Internet
Author: User

Javascript Back to previous page

1. Javascript returns to the previous page history.go (-1) and returns two pages: History.go (-2);

2. History.back ().

3. Window.history.forward () Back to next page

4. Window.history.go (returns the first few pages, also can use the visited URL)

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.
Tips (JS reference js):
<script type=text/javascript>
<!--
if (typeof swfobject = = "undefined") {
document.write (' <scr ' + ' IPT type= "Text/javascript" src= "/scripts/swfobject-1.5.js" ></scr ' + ' ipt> ');}
-->
</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. Page Automatic refresh: Add the following code to the <meta http-equiv= "Refresh" content= ">"
20 of which means that the page is refreshed every 20 seconds.

2. Page Automatic Jump: Add the following code to the <meta http-equiv= "Refresh" content= "20;url=http://www.45it.com" >
20 of which refers to 20 seconds after the jump to the http://www.45it.com/page

3. Page automatically refresh JS version
<script language= "JavaScript" >
function Myrefresh ()
{
Window.location.reload ();
}
SetTimeout (' Myrefresh () ', 1000); Specify 1 seconds to refresh once
</script>

Asp. NET how to output refresh the parent window script statement
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 Frame Script statement

How to refresh the page that contains the frame with
<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>

If you want to close the window or refresh when you want to open windows, call the following statement in <body>.

<body onload= "Opener.location.reload ()" > Refresh when opening windows
<body onunload= "Opener.location.reload ()" > Refresh when closed

<script language= "JavaScript" >
Window.opener.document.location.reload ()
</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.