Home > Web Front-end > JS Tutorial > js refresh frame subpage

js refresh frame subpage

巴扎黑
Release: 2016-11-25 13:42:56
Original
1028 people have browsed it

Seven methods of refreshing frame subpages in js
The following uses three pages named framedemo.html, top.html, button.html as an example to explain how to do it in detail.
Framedemo.html consists of two pages, the upper and lower pages, and the code is as follows:



frameDemo



< frame name=button src="button.html">


Now assuming that top.html, the page above, has a button to refresh the page below, you can use the following seven methods It's up to you to decide which one of these statements is easier to use.
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();
Explanation:
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 an array. Represents all subpages within the frame.
4.item is the method. Returns the elements in the array.
5. If the subpage is also a frame page with other subpages inside, then some of the above methods may not work.
top.html source code; (There are seven buttons on the page, the functions of which are to refresh the frame page below)

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template