Iframe utility operates on brocade

  • 2020-03-30 02:43:21
  • OfStack

The iframe height is set to the height of the child page
//You need to use Jquery
$(document).ready(function () { 
parent.document.getElementById("ifPage").style.height = document.body.scrollHeight + "px"; 

The iframe height is adaptive to the parent page
//You need to use Jquery
$(window).resize(function () { 
var webheight = document.body.clientHeight - X; //X is the amount of height you have to subtract, like the height of the top navigation
$("#ifPage").attr("style", "height:" + webheight + "px;"); 
$(window).load(function () { 
var webheight = document.body.clientHeight - 105; 
$("#ifPage").attr("style", "height:" + webheight + "px;"); 

Passing elements between parent and child pages
The parent page gets the data in the child page. JS code:
//Gets the object based on the id of the iframe
var i1 = window.frames['iframeId']; 
//Var iframe window. = frames [0]; Can also be
//Gets the value of the element in the iframe
var val=i1.document.getElementById("t1").value 

Child page to get the data in the parent page, JS code:
var val = parent.document.getElementById("txt1"); 

Transfer between child pages, JS code:
var i1 = parent.window.frames['iframeId']; 
var val = i1.document.getElementById("text1").value; 

Refresh the parent page
function parentReload() { window.parent.location.reload();} 

Reload the child page
iframe.Attributes[ "Src"] = "ItemTQEditorPage.aspx"; 

Related articles: