iframe父子页面间互相调用方法和属性

<iframe src="VideoController.do?videoPlay" name="topFrame" ></iframe> 

topFrame 是父级页面iframe的name属性

1、父级页面调用子级页面

(1)父级页面调用子级页面方法 

  topFrame.window.子级页面方法();

(2)父级页面调用子级页面属性    获取值、显示隐藏、变量

  topFrame.window.document.getElementById("back").style.display="block";

  topFrame.window.document.getElementById("back").innerText;

  topFrame.window.document.getElementById("back").value;

  topFrame.window.cId;

2、子级页面调用父级页面

(1)子级页面调用父级页面方法

  window.parent.父级页面方法();

(2)子级页面调用父级页面属性    获取值、显示隐藏、变量

  twindow.parent.document.getElementById("PtzPreset1").style.display="block";

  window.parent.document.getElementById("PtzPreset1").innerText;

  window.parent.document.getElementById("back").value;;

  window.parent.cId;

原文地址:https://www.cnblogs.com/dxt510/p/10432043.html