JavaScript Basics-Window objects (Windows)

Source: Internet
Author: User

1.top

This change 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.
2.opener
Opener The object that is used to refer to the page that executes the window.open method on the window.open page. For example: A page with the window.open () method pops up the B page, in the B page can be opener to reference a page, so you can use this object to the a page operation.
3.parent
The parent is used to access the object in the child page that is generated in iframe,frame. For example: A page has an IFRAME or frame, then the page in the IFRAME or frame can refer to the object in page A through the parent object, so that the value can be obtained or returned to the a page.
4. In addition, self refers to the current window

(1) Window.top

(2) Window.opener

(3) Window.parent

(4) Self

(5) The difference between parent and opener

Parent refers to the Father window, and the parent of frame in frameset is the frameset window;

Opener refers to the original window corresponding to the new window created by window.open and other means;

The parent is an object that is relative to the frame;

opener is the parent window for a window opened with window.open, provided the window.open is open. Document.parentWindow.menthod () How to adjust the parent page

<! doctype html public  "-//w3c//dtd xhtml 1.0 transitional//en"   "HTTP// Www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">

Attached: Window object, parent object, frame object, Document object, and hierarchy Relation of Form Object Window object →parent Object →frame Object →document object →form object, as follows:

Parent.frame1.document.forms[0].elements[0].value;

JavaScript Basics-Window objects (Windows)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.