动态改变父类iframe的高度,获取高度小于720时,高度为720
// iframe页面调用的js
function loadHeight(){
var iframe = window.parent.document.getElementById("showRight");
iframe.height=720;
getHeight(iframe);
setInterval("getHeight()",500);
// setTimeout("loadHeight()",500);
}
function getHeight(){
// 取到窗口的高度
var iframe = window.parent.document.getElementById("showRight");
// var idocumentElement = iframe.contentWindow.document.documentElement;
var idocumentElement = document.body;
// iframe.height = idocumentElement.scrollHeight;
if (idocumentElement.scrollHeight > 720) {
// iframe.height -=5;
iframe.height = idocumentElement.scrollHeight;
}
else {
iframe.height = 720;
}
}
// iframe页面调用的js
function loadHeight(){
var iframe = window.parent.document.getElementById("showRight");
iframe.height=720;
getHeight(iframe);
setInterval("getHeight()",500);
// setTimeout("loadHeight()",500);
}
function getHeight(){
// 取到窗口的高度
var iframe = window.parent.document.getElementById("showRight");
// var idocumentElement = iframe.contentWindow.document.documentElement;
var idocumentElement = document.body;
// iframe.height = idocumentElement.scrollHeight;
if (idocumentElement.scrollHeight > 720) {
// iframe.height -=5;
iframe.height = idocumentElement.scrollHeight;
}
else {
iframe.height = 720;
}
}