Home > Web Front-end > JS Tutorial > In-depth analysis of the role of top in js_javascript skills

In-depth analysis of the role of top in js_javascript skills

WBOY
Release: 2016-05-16 16:57:28
Original
1228 people have browsed it

Every WINDOW object, whether it is a regular HTML page. Frameset page. Whether a child frame or a grandchild frame, both have a TOP attribute. This attribute returns a reference to the top-level WINDOE object loaded into the browser;

. If the WINDOW object is a regular HTML page, TOP is SELF
. . . . . . . Top-level frames and pages, . . . . . . . .
. . . . . . . Subframe, TOP points to the parent of the frame, that is to say, the following two expressions are equivalent;
SELF.TOP
SELF.PARENT

. If the WINDOW object is a subframe, TOP points to the frame's grandparent. In other words, the following two expressions are equivalent to
self.top
self.parent.parent
This may remind you of a good way to reduce keystrokes, especially if you think you can In order to only apply TOP itself (that is, use TOP itself instead of SELF.TOP or WINDOW.TOP), although this is feasible, special attention should be paid: you must ensure that TOP actually points to your top-level framework

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