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;

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM