javascript| Refresh | page
Here are three pages named framedemo.html,top.html,button.html as an example to specify how to do this.
The framedemo.html consists of the top and bottom two pages, the following code:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 transitional//en" >
<HTML>
<HEAD>
<TITLE> Framedemo </TITLE>
</HEAD>
<frameset rows= "50%,50%" >
<frame name=top src= "top.html" >
<frame Name=button src= "button.html" >
</frameset>
</HTML>
Now assume that top.html that the above page has a button to achieve the following page refresh, you can use the following seven kinds of statements, which easy to do with their own.
Statement 1. Window.parent.frames[1].location.reload ();
Statement 2. Window.parent.frames.bottom.location.reload ();
Statement 3. window.parent.frames["Bottom"].location.reload ();
Statement 4. Window.parent.frames.item (1). Location.reload ();
Statement 5. Window.parent.frames.item (' Bottom '). Location.reload ();
Statement 6. Window.parent.bottom.location.reload ();
Statement 7. window.parent[' Bottom '].location.reload ();
Explain:
1.window refers to the current page, for example, for this 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, for this example, it refers to framedemo.html.
3.frames is a Window object and is an array. Represents all the subpages within the frame.
4.item is the method. Returns the elements inside an array.
5. If the child page is also a frames page, inside or other sub pages, then some of the above methods may not work.
top.html source code; (There are seven buttons on the page, the function is to refresh the frames page below)
<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 transitional//en" >
<HTML>
<HEAD>
</HEAD>
<BODY>
<input Type=button value= "Refresh 1" ><br>
<input Type=button value= "Refresh 2" ><br>
<input Type=button value= "Refresh 3" ><br>
<input Type=button value= "Refresh 4" ><br>
<input Type=button value= "Refresh 5" ><br>
<input Type=button value= "Refresh 6" ><br>
<input Type=button value= "Refresh 7" ><br>
</BODY>
</HTML>
The following is the bottom.html page source code, in order to prove that the bottom page is indeed refreshed, after loading the page pop-up a dialog box.
<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 transitional//en" >
<HTML>
<HEAD>
</HEAD>
<body >
</BODY>
</HTML>