The seven methods for js to refresh the framework subpage are described in detail by naming the three pages as framedemo.html, top.html, and button.html.
In this example, framedemo.html consists of two pages:
The Code is as follows:
FrameDemo
Now, let's set the top.html, that is, there is a button on the above page to refresh the following page. You can use the following seven statements.
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 ();
Explanations:
1. windowless refers to the front page. For example, this refers to the top.html page.
2. parent refers to the parent page of the current page, that is, the framework page containing it. In this example, framedemo.html is used.
3. frames is a window object and an array. Represents all the child pages in the framework.
4. item is a method. Returns the elements in the array.
5. If the sub-page is also a framework page and contains other sub-pages, some of the above methods may not work.
Top.html source code; (there are seven buttons on the page, and the function is to refresh the following framework page)
The Code is as follows:
The following is the source code of the bottom.html page. to verify that the page below is refreshed, a dialog box is displayed after the page is loaded.
The Code is as follows:
This is the content in button.html.