var iframeids = ["memberIndexIframe", "inquiryCenterIframe", "everychinaBbsIframe"];
var iframehide = "yes";
function dynIframeSize() {
var dyniframe = [];
for (var i = 0; i < iframeids.length; i++) {
if (!document.getElementById) {
return false;
}
dyniframe[i] = document.getElementById(iframeids[i]);
if (dyniframe[i] && !window.opera) {
dyniframe[i].style.display = "block";
if (dyniframe[i].contentDocument && dyniframe[i].contentDocument.body.offsetHeight) {
dyniframe[i].height = dyniframe[i].contentDocument.body.offsetHeight;
} else {
if (dyniframe[i].Document && dyniframe[i].Document.body.scrollHeight) {
dyniframe[i].height = dyniframe[i].Document.body.scrollHeight;
}
}
}
if ((document.all || document.getElement) && iframeids == "no") {
var tempobj = document.all ? document.all[iframeids[i]] : document.getElementById(iframeids[i]);
tempobj.style.display = "block";
}
}
}
if (window.addEventListener) {
window.addEventListener("load", dynIframeSize, false);
} else {
if (window.attachEvent) {
window.attachEvent("onload", dynIframeSize);
} else {
window.onload = dynIframeSize;
}
}
iframe自动适应高度(不跨域)
最新推荐文章于 2024-06-14 15:13:12 发布