Ways to automatically refresh pages:
1. Page Automatic refresh: Add the following code to the
The code is as follows |
Copy Code |
<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
The code is as follows |
Copy Code |
<meta http-equiv= "Refresh" content= "20;url=http://www.111cn.net" >
|
20 of which refers to 20 seconds to jump to the page
3. Page automatically refresh JS version
The code is as follows |
Copy Code |
<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
The code is as follows |
Copy Code |
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
The code is as follows |
Copy Code |
<script language=javascript> Parent.location.reload (); </script> |
child window refreshes parent window
The code is as follows |
Copy Code |
<script language=javascript> Self.opener.location.reload (); </script> (or <a href= "javascript:opener.location.reload ()" > Refresh </a>) <script language=javascript> Parent.otherFrameID.location.reload (); </script> |
If you want to close the window or refresh when you want to open windows, call the following statement in <body>.
The code is as follows |
Copy Code |
<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> |
The onload is only executed when the page loads
Only perform onunload when page closes
When the page is refreshed, execute onbeforeunload First, then onunload, and finally onload. So we can add a tag in the onbeforeunload and judge the tag in the onunload to determine if the page is really closed.