20 refers to a refresh of the page every 20 seconds.
<meta http-equiv= "Refresh" content= "20;url=http://www.jb51.net" >Where 20 means jump to http://www.jb51.net page after 20 seconds
3, page automatically refresh JS version
<script language= "JavaScript" >function Myrefresh () { window.location.reload ();} SetTimeout (// specify 1 seconds to refresh once </script>
4,js script statements that refresh the framework
// Refresh the page containing the frame with <script language=javascript> parent.location.reload (); </script>// child window Refresh parent window <script language=javascript> Self.opener.location.reload (); </script> (or <a href= "javascript:opener.location.reload ()" > Refresh </a> )// Refresh the page of another frame with <script language=javascript> parent. Another FrameID.location.reload (); </script>
If you want to refresh when you close the window or if you want to open it, call the following statement in <body>.<body onload= "Opener.location.reload ()" > Windows Refresh <body onunload= "opener.location.reload ()" > Refresh <script language= "JavaScript" >window.opener.document.location.reload ()on Close </script>
First, let's look at a simple example:
The following three pages were named Frame.html, top.html, bottom.html as an example to specify how to do.
Frame.html consists of two pages (top.html) under (bottom.html), the code is as follows:
Now assume that top.html (that is, the page above) has seven buttons to implement the bottom.html (that is, the following page) refresh, you can use the following seven kinds of statements, which is good to see.
The code for the Top.html page is as follows:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 transitional//en"> <HTML> <HEAD> <TITLE>Top.html</TITLE> </HEAD> <BODY> <inputtype=buttonvalue= "Refresh 1"onclick= "Window.parent.frames[1].location.reload ()"><BR> <inputtype=buttonvalue= "Refresh 2"onclick= "Window.parent.frames.bottom.location.reload ()"><BR> <inputtype=buttonvalue= "Refresh 3"onclick= "window.parent.frames[' Bottom '].location.reload ()"><BR> <inputtype=buttonvalue= "Refresh 4"onclick= "Window.parent.frames.item (1)." Location.reload () "><BR> <inputtype=buttonvalue= "Refresh 5"onclick= "Window.parent.frames.item (' Bottom '). Location.reload ()"><BR> <inputtype=buttonvalue= "Refresh 6"onclick= "Window.parent.bottom.location.reload ()"><BR> <inputtype=buttonvalue= "Refresh 7"onclick= "window.parent[' Bottom '].location.reload ()"><BR> </BODY> </HTML> Here is the bottom.html page source code, in order to prove that the page below is indeed refreshed, in the loading page pop up a dialog box.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 transitional//en"> <HTML> <HEAD> <TITLE>Bottom.html</TITLE> </HEAD> <BODYonload= "alert (' I was loaded!") ') "> <H1>The content in bottom.html.</H1> </BODY> </HTML> Explain: 1.window refers to the current page, for example it refers to the top.html page.
2.parent refers to the parent page of the current page, which is the frame page that contains it. For example, in this case, it refers to framedemo.html.
3.frames is a Window object and is an array. Represents all the sub-pages within the framework.
4.item is the method. Returns the elements inside the array.
5. If the sub-page is also a frame page, inside or another sub-page, then some of the above methods may not work.
Report:
JavaScript refreshes the page in several ways:History.go (0) location.reload ()location = Location Location.assign (location) Document.execcommand ( ' Refresh ') window.navigate (location) Location.replace document. URL
Second, automatically refresh the page1. 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.jb51.net" >
Where 20 means jump to http://www.jb51.net page after 20 seconds
3. Page automatically refresh JS version
<textarea id="runcode81283"></textarea>
[Ctrl + A full selection Note: If you need to introduce external JS need to refresh to execute]
Third, Java in the writing servler,action, and so on, to operate back to the page (such as talking about the window, after the completion of the operation, close the current page, refresh the parent page)
PrintWriter out = response.getwriter (); Out.write ("<script type=\" text/javascript\ ">"// Out.write ("Self.opener.location.reload ();" //out.write ("window.opener=null;") ); Out.write ("window.close ();" ); Out.write (
Iv. script statements for JS Refresh framework
1. How to refresh the page containing the frame
<script language=javascript>
2. child window Refreshes parent window
<script language=javascript>
3. How to refresh the page of another frame (above example to illustrate)
Window.parent.frames[1].location.reload (); Window.parent.frames.bottom.location.reload (); window.parent.frames["Bottom"].location.reload (); Window.parent.frames.item (1). Location.reload (); Window.parent.frames.item (' bottom '). Location.reload (); Window.parent.bottom.location.reload (); window.parent[
4. Call the following statement in <body> if you want to refresh the window or refresh it when you want to open it.
<body onload= "Opener.location.reload ()" >
Refresh when opening windows
<body onunload= "Opener.location.reload ()" >
Refresh when off
<script language= "JavaScript" >
JS Refresh page