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