parent

1.parent对象

   1>window.parent和window.opener

      window.parent iframe页面调用父页面对象,当我们想从iframe内嵌的页面中访问外层页面是可以直接利用window.parent获取;

      window.opener window.open或超链接<a> 打开的子页面调用父页面对象; 

parent.window与top.window一般在分割的页面即 frameset或iframe中使用;

window.parent也是常在框架中使用,

刷新:window.parent.location.reload();或者刷新某个框架:window.parent.MainForm.location.reload();

获得其他框架的元素值:window.parent.MainForm.form1.text1.value;

window.opener主要是获得通过超链接或者 window.open() 打开本身页面的页面的一些,比如获得值,刷新等

刷新:window.opener.location.reload();

获值:window.opener.document.getElement("txtName").value;

后退:top.playFrame.history.go(-1);

前进: top.playFrame.history.go(1);

刷新: top.playFrame.location.reload();

 

附:Window对象、Parent对象、Frame对象、Document对象和Form对象的阶层关系 
Window对象→Parent对象→Frame对象→Document对象→Form对象,
如下: parent.frame1.document.forms[0].elements[0].value;

2.parent()方法

   parent() 获得当前匹配元素集合中每个元素的父元素,使用选择器进行筛选是可选的。

$("p").parent(".selected");  查找每个段落的带有 "selected" 类的父元素;  

 

原文地址:https://www.cnblogs.com/hym-pcitc/p/5660634.html