Relationship between windows and forms, relationship between windows and forms

Source: Internet
Author: User

Relationship between windows and forms, relationship between windows and forms
Relationship between windows and forms:Through window. the Window object of the new Window created by open () has the opener attribute. You can open its original Window through opener so that the two windows can be referenced by each other, you can read the attribute methods of each other, and the form is the same. The form is created by <iframe>. The element has the contentWindow attribute, which references its own Window object. The Window object has the frameElement attribute. If the Window object represents a form, frameElement is a reference to the <Iframe> element, for example, for the element <iframe id = 'f1'>, var elt = document. getElementById ('f1'); var win = elt. contentWindow; win. frameElement = elt; // true window. frameElement = elt; // false is always false for top-level windows. Each Window object has a frames attribute, including the form and subform. The frames attribute references the Window objects of the forms and subforms it contains. frames is a class array object composed of these Window objects, which can be indexed by numbers or form names, for example, reference the first child form frames [0] and reference the third child form frames [1] of the second child form. frames [2], referencing the sibling form parent. frames [1]. Built-in objects are independent of each other in different windows and forms. They have their own copy of independent constructors and prototype objects, it is automatically pre-defined in all window forms, while custom objects are different. The constructor and prototype of the object can be shared between windows and forms that can communicate with each other; for example, if the window defines the Set class with sub-Forms A and B, in the parent window: var s = new Set (); String. toString = function () {return 'built-in object';} (modify the toString method of String) s. a = 1; // true in A: var sa = new parent. set (); parent. set. prototype. a = 1; (If attribute a is added to the prototype of the custom class Set, all the windows that can communicate with each other share a) var str = 'test'; str. toString; // test (the toString method of the String object of Form A is called) in B: var Set = top. set (); var sb = new Set (); sb. a = 1; // true to reference a form in the window, you can use the following syntax: frames [I] // framework self of the current window. frames [I] // frame of the current window w. frames [I] // the framework of window w references the parent window (or parent frame) of a Framework. You can use the following syntax: parent // The parent window self of the current window. parent // The parent window w of the current window. the parent window of parent // window w must be referenced from any framework contained in the top-level window. You can use the following syntax: top // top-level window self of the current framework. top // top-level window of the current framework f. top // top-level window of framework f

Related Article

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.