In the past has been written in front of the UI, rarely used to frameset, IFRAME, the understanding is very limited, just know that it can be introduced to its current page HTML file as part of the current page, but these two days in the background UI interface, The discovery of such a framework also has a considerable number of knowledge points in the inside. What's the frame? You can say this: by using the framework, you can display more than one page in the same browser window. Each HTML document is called a frame, and each frame is independent of the other. So there are several aspects of the framework that I need to know:
(1) Get the frame on the HTML page
Window.frames can get all the frame collections on this page, using the same usage as the Document.forms,document.imgs, which is a window object that gets a framework that can do this window.frames[0 ], window.frames[' framename '], frames[' framename '], frames[0], self.frames[0], where self is equivalent to window, the Window object of this page.
There are also two properties to look at, Contentwindow, contentdocument two properties, and also the window object that can be used to get the child window of a frame.
Contentwindow compatible with each browser, you can get the window object of the Subwindow.
Contentdocument Firefox supports,> IE8 's IE support. The document object that can get the child window.
If I want to refresh the page of the first frame on this page, what can I do:
Window.frames[0].contentwindow.location.reload ();
(2) The parent frame invokes the variable or function of the child frame
To get the frame on the page in conjunction with the above, the variable or function that calls the child frame can do this:
Frames[0].a;frames[0].refresh (); alert (frames[0].location.href);
This is called the A variable and the refresh function inside the first frame.
(3) The child framework calls the parent frame's variable or function
In this case where the child framework calls the parent frame, window has a property called parent, which is used to invoke the upper frame, so you can:
Window.parent.a;window.parent.refresh ();
This is the A variable called the parent frame called by the child Framework and the refresh function.
(4) A call between sibling frames
Can be called from one another through their parent framework.
self.parent.frames[' child1 '];self.parent.frames[' child2 '];
(5) Multi-layered frame invocation
Window.frames[0].frames[2];window.frames[' child_1 '].frames[' sub_child_3 '];
(6) Top-level frame
The first thing you need to determine is whether it is the top-level frame, or root, that can be done:
if (self==window.top) { //.... }/*Another property top of the window that represents a reference to the top-level frame, which can be used to determine if a frame is itself a top-level frame.
How to call variables, functions between frameset,iframe frameworks