The iframe height is set to the child page height
Copy Code code as follows:
Need to use jquery
$ (document). Ready (function () {
Parent.document.getElementById ("Ifpage"). Style.height = document.body.scrollHeight + "px";
});
IFRAME highly adaptive to parent page
Copy Code code as follows:
Need to use jquery
$ (window). Resize (function () {
var webheight = document.body.clientheight-x; X is the amount of height that needs to be subtracted, such as 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-child pages
Parent page Gets the data from the child page, JS code:
Copy Code code as follows:
Gets an object based on the ID of the IFRAME
var i1 = window.frames[' Iframeid '];
var iframe =window.frames[0]; you can also
Gets the element value in the IFRAME
var Val=i1.document.getelementbyid ("T1"). Value
Sub-page Gets the data in the parent page, JS code:
Copy Code code as follows:
var val = parent.document.getElementById ("Txt1");
Sub-page and sub-page transfer between, JS code:
Copy Code code as follows:
var i1 = parent.window.frames[' Iframeid '];
var val = i1.document.getElementById ("Text1"). Value;
Refreshing the parent page
Copy Code code as follows:
function Parentreload () {window.parent.location.reload ();}
Reload Child pages
Copy Code code as follows:
Iframe. attributes["SRC"] = "itemtqeditorpage.aspx";