var ifr = document.getElementById("m_ifr");
if (ifr.attachEvent){
ifr.attachEvent("onload", function(){
//获取Iframe的内容实际高度
var iframeHeight= ifr.contentWindow.document.documentElement.scrollHeight;
//设置Iframe的高度
ifr.style.height=iframeHeight+"px";
});
}else{
ifr.onload = function(){
//获取Iframe的内容实际高度
var iframeHeight= ifr.contentWindow.document.documentElement.scrollHeight;
//设置Iframe的高度
ifr.style.height=iframeHeight+"px";
};
}
iframe 自适应高度
最新推荐文章于 2024-03-29 11:18:46 发布