iframe自适应高度
①$(document).ready(function(){
var bodyheight=$("body").height();
window.parent.set_iframe_height(bodyheight);
});
function setIframeHeight(height){
iframe=document.getElementById('iframe');
iframe.height=height;
}
②
var body=document.getElementsByTagName('body');
var body_height=body.offsetHeight;
window.parent.setIframeHeight(body_height);
③
“<iframe>标签自适应高度和宽度”(http://www.cnblogs.com/Nbge/archive/2013/06/14/3135697.html)
function iFrameHeight() {
var ifm= document.getElementById("iframepage");
var subWeb = document.frames ? document.frames["iframepage"].document : ifm.contentDocument;
if(ifm != null && subWeb != null) {
ifm.height = subWeb.body.scrollHeight;
ifm.width = subWeb.body.scrollWidth;
}
}
页:
[1]