js difference in window.parent and window.opener

2011-06-01  来源:本站原创  分类:Web  人气:198 

The following piece of code is about window.parent and window.opener difference in terms of the, if we use the value to the iframe to another frame is necessary to use window.opener.document.getElementById (name). Value = uvalue; this Oh forms.

window.parent can get a frame of the parent window or parent frame. Top-level reference to the parent window itself.

This feature can be used to determine whether this window is the top-level window. Such as:

Code
function IsTopWindow (win)
{
if (win.parent == win) return true;
else return false;
}
window.opener refers to the window.open to open the pages of the parent page.

opener that is, who opened to me, such as A page B page using pop-up window, window.open, then the page where the window A is B page opener, the B page can be accessed through the opener object A page.
parent that the parent window, such as a page using iframe or frame A calls B page, then A page B page where the window is the parent.
In the JS in, window.opener just pop a reference to the parent window. For example:

a.html in other ways by clicking the button a new window window.open b.html. Then b.html, it is possible through the window.opener (omitting to write for the opener) to refer to a.html, include the document a.html and other objects, the operation a.html content. If the reference fails, then return null. Therefore, the object before calling the opener, we must first determine whether the object is null, it will lead to "object is empty or does not exist" JS error.

window.opener returns the current window to create a reference to the window, such as clicking on a link and a.htm open b.htm, and we intend to enter a value in the b.htm a.htm then given on an id for the "name" in the textbox, then you can write to:
window.opener.document.getElementById ("name"). value = "input data";

This tutorial web page production from www.zzarea.com Original link: http://www.zzarea.com/JavaScript/javascript-1200.html

相关文章
  • js difference in window.parent and window.opener 2011-06-01

    The following piece of code is about window.parent and window.opener difference in terms of the, if we use the value to the iframe to another frame is necessary to use window.opener.document.getElementById (name). Value = uvalue; this Oh forms. windo

  • window.parent与window.openner区别介绍 2014-11-07

    今天总结一下js中几个对象的区别和用法,对这几个概念混淆的朋友可以看看 今天总结一下js中几个对象的区别和用法: 首先来说说 parent.window与top.window的用法 "window.location.href"."location.href"是本页面跳转 "parent.location.href"是上一层页面跳转 "top.location.href"是最外层的页面跳转 举例说明: 如果A,B,C,D都是js

  • window.parent与window.openner 2014-07-24

    window.parent与window.openner区别介绍 作者: 字体:[增加 减小] 类型:转载 今天总结一下js中几个对象的区别和用法,对这几个概念混淆的朋友可以看看 今天总结一下js中几个对象的区别和用法: 首先来说说 parent.window与top.window的用法 "window.location.href"."location.href"是本页面跳转 "parent.location.href"是上一层页面跳转 &quo

  • window.parent difference with window.opener 2010-03-19

    Keywords: window.parent difference with window.opener [Change] javascript calling parent window (parent page) method. 1: window.parent iframe page is called the parent page object For example: a.html Code <html> <head> <title> parent pag

  • window.opener difference with window.parent 2010-04-10

    If we use the value to the iframe to another frame is necessary to use window.opener.document.getElementById (name). Value = uvalue; this form of Oh. window.parent can get a frame of the parent window or parent frame. Top-level reference to the paren

  • JS iframe父子页面元素调用方法 | window parent top opener 解释 2013-03-05

    iframe 父窗口调用子窗口 var hasMore = parent.document.getElementByIdx_x_x_x("hasMore").value; 子窗口调用父窗口 document.frames["ifrmBoxFrame"].me.preLoadBoxGrid(); window.frames["iframe_ID"].document.getElementByIdx_x_x_x("iframe_docume

  • window.parent & window.opener 2010-06-15

    window.parent for frame Parent page: <html> <head> <title> parent page </ title> </ head> <body> <form name="form1"> <input type="text" name="username"/> </ Form> <ifra

  • Server pop-up window js method calls the parent window 2010-03-30

    Some time ago the Internet search has been called the parent window on child window method, or passed by value to the parent window. However, most of them are js pop-up window, you rarely see there is action on the pop-up window to return to call the

  • iframe inside the page calls the parent window, so the window function method js 2010-08-22

    iframe inside the page calls the parent window, so the window function method js iframe inside the page calls the parent window, so the window method to achieve iframe js function to call the iframe within the page directly to their parent window cus

  • JS call iframe parent window and child window elements element method 2010-10-28

    JS call iframe parent window and child window elements element method, pretty good. 1, call the child window parent window: window.frames ["iframe_ID"]. document.getElementById ("iframe_document_object"). object_attribute = attribute_v

  • page inside the iframe call the parent window, so the window function method js 2010-11-18

    page inside the iframe call the parent window, so the window function method to achieve iframe js page directly call within the parent window of the iframe belongs to the custom functions. A window such as there, A There are a IFRAME B, B is C inside

  • Summary JavaScript (Iframe.window.open.window.showModalDialog) between the parent window and child window operation 2010-03-26

    Some time ago, has been shuttling the three operations, think of the future will be used, simply finishing down for their future view. Also to share with you! Considered useful in the following write their own operations and code. For the first time

  • JavaScript child window parent window and the interaction between 2010-06-06

    // The parent object is the value of a child window //ObjectID Is Windows identity, ContentID is element ID function GetValue(ObjectID,ContentID) { var IsIE = (navigator.appName == 'Microsoft Internet Explorer') if(IsIE){// If you are IE alert(docume

  • js of the parent object and opener object 2010-08-05

    The change means the split window is always the highest level of the browser window. If you plan to split the window from the highest level of command started, you can use the top variable. parent: This variable refers to the partition containing the

  • Summary of JavaScript (Iframe.window.open.window.showModalDialog) between the parent window and child window operation 2010-09-29

    A, Iframe articles //&&&&&&&&&&&&&&&&&&&& Public method start &&&&&&&&&&&&&&& / / Get parent value of child window

  • To close the child window parent window refresh problem 2008-09-20

    Dealing with prompt box Click the Close button to refresh the parent window is not the problem - Use the window.open () method, click on refresh the parent page after the closure of ways: In the sub-page: window.onunload = function () ( window.opener

  • How to refresh child window parent window 2010-03-10

    Child window to refresh the parent window, if it is window.open (), then directly window.opener.location.reload (), if window.showModalDialog (), it is not window.opener inside, the opener can not be quoted parent window, or a direct call with error.

  • iframe parent window and child window call another method Collection 2010-05-04

    First, call the iframe parent window a child window method 1, HTML syntax: <iframe name="myFrame" src="child.html"> </ iframe> 2, the parent window call the child window: myFrame.window.functionName (); 3, sub-window produc

  • iframe parent window and child window call another method 2010-07-18

    First, call the iframe parent window a child window method 1, HTML syntax: <iframe name="myFrame" src="child.html"> </ iframe> 2, the parent window call the child window: myFrame.window.functionName (); 3, sub-window produc

  • Parent window to child window by value 2010-11-03

    Parent window to child window by value: url = url + '? winFlg = aaa & winPig = bbb'; window.open (url,'',''); Child window: var URLParams = new Object (); var aParams = document.location.search.substr (1). split ('&'); for (var i = 0; i <aParam