Calls between parent and child pages in JavaScript

Source: Internet
Author: User

This article was mainly transferred from: http://www.360doc.com/content/11/0525/17/6161903_119333834.shtml
Http://zhidao.baidu.com/question/178864421.html

The parent-child page calls each other several ways to summarize:

First: Use window.open () to open a new window

parent page called Child page:

The child page is opened with window.open and the method is called

var AA = window.open ();

Aa. Child ();//child () is a sub-page method

The child page calls the parent page:

Window.opener. The parent ()//Window.opener is actually a form that is opened by window.open.


The second type: using an embedded frame call

For example: <iframe src= "/**.jsp" width= "100%" height=100% name= "Mapframe" ></iframe>

parent page Calling child page

Mapframe. Child ();//mapframe is the name value of the frame in the parent page, and the method

Set the ID:document.getElementById (' Iframeid ') to the IFRAME. CONTENTWINDOW.ABC (); ABC () is a sub-page function

Child page called parent page

Window.parent. Parent ()



The third type: Using window.showModalDialog (), open a new window

ShowModalDialog ('/window.jsp ', window, ' Dialogheight:300px;dialogwidth:600px;status=off ');

Parent page cannot invoke a child page method

Child page called parent page

Window.dialogarguments. Parent ();

Calls between parent and child pages in JavaScript

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.