Basic knowledge of operating the parent window object_in ModalDialog In the JavaScript subwindow

Source: Internet
Author: User
When using js, you will encounter the following requirement: I am sorry to use the Child Window to operate the parent window image, so I searched and sorted it out and shared it with you, for more information about how to operate parent window objects in ModalDialog, see
1. window. parent cannot be used.
Window. parent is used to operate in the frame. It cannot be used to operate the parent Window object in the dialog box.

2. correct practices
You can call modaldialog by passing parameters.
Example:
Requirement
The parent window is a.html and B .html. A.html has a dialog box named test1. Click a button in the dialog box to change the text box value of a.html to "subwindow value ".
Implementation
When the dialog box is opened, set test1as a parameter to the window. In the window, obtain the parameter value, and set the value attribute value of the text object (that is, the text object passed in a.html) to "subwindow value"
Note: Only id and name are allowed.
A.html code:

The Code is as follows:





A.html







B .html code:

The Code is as follows:





B .html

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.