Top: Always refers to the top-level browser window of the split window; Parent: Contains the window of the current split Windows, this article will be around JS top, parent, frame and their application case
top of reference method:
This variable always refers to the top-level browser window of the split window. If you plan to execute commands from the top level of the split window, you can use the top variable.
Parent:
This variable refers to the parent window that contains the current split window. If there is a split window within a window, and a split window is included in one of the split Windows, the 2nd split window can refer to the parent partition window that contains it.
Attached: Hierarchy Relationship of Window object, parent object, frame object, Document object, and Form object
The Windwo object →parent object →frame Object →document object →form object, as follows:
Parent.frame1.document.forms[0].elements[0].value;
In JS: window.location (Window.location.href) and window.top.location (WINDOW.TOP.LOCATION.HREF) are the same meaning You can call any frame by top, because top refers to the outermost frameset, which can call any of its child elements in the frame. such as: Top.outterFrame1.location and Top.innerFrame2.location and so on.
The parent refers to the current window (frame) of the parents window (frameset) can call any of its child elements inside the frame. such as: Parent.innerFrame1.location and Parent.innerFrame2.location and so on.
"JavaScript"Type="Text/javascript">window.location.href="http://www.baidu.com/";</script>"Outframeset"Rows="150,*,150"cols="*"Border="5"><frame name="frameName1"Id="frameId1"Src="a.html"><frameset id="Inframeset"cols="150,*"Rows="*"><frame name="innerFrameName1"Id="innerFrameId1"Src="a.html"><frame name="innerFrameName2"Id="innerFrameId2"Src="a.html"></frameset><frame name="frameName2"Id="frameId2"Src="a.html"></frameset>View CodeOne of your own example code (Permissions Top,left,right page, in the top window of the page to get a connection address, let the left window to request this address, and will respond back to the page, displayed in the left window) of a JSP code
1 //when the top page has finished loading, the left page automatically displays the level two menu under top first level menu2 $ (document). Ready (function () {3 //gets the object that iterates through the first hyperlink4 varfirsta=$ ("#turnto1");5 varAhref=firsta.attr ("href");6 //when the top page has finished loading, the left page automatically sends the connection address of the first step-through menu. 7parent.leftframe.location.href=Ahref;8 9 });Ten</script> One A -<body style="Background:url (<%=request.getcontextpath ()%>/master/images/topbg.gif) repeat-x;"> - the<divclass="TopLeft"> -<a href="<%=request.getcontextpath ()%>/master/main.jsp"target="_parent">"<%=request.getcontextpath ()%>/master/images/logo.png"title="System Home"/></a> -</div> - +<ulclass="nav"> - + A at<c:foreach items="${list}" var="Powers"varstatus="VARs"> - -<li><a href='<%=request.getcontextpath ()%>${powers.syspowerurl}=${powers.syspowerid}'Id="Turnto${vars.count}"target="Leftframe" class="selected">"<%=request.getcontextpath ()%>/master/images/icon01.png"title="${powers.syspowername}"/> - -</c:forEach> - in -</ul>View Code