//iframe自适应高度
function getHeight(id, name) {
document.documentElement.scrollTop = 0;
var ifm = document.getElementById(id);
var subWeb = document.frames ? document.frames[name].document :
ifm.contentDocument;
if (ifm != null && subWeb != null) {
ifm.height = subWeb.body.scrollHeight;
}
initParentHeight(); //这个是再初始化父页面的iframe的高度
}
function initParentHeight() //初始化父页面的iframe的高度
{
var div = window.parent.document.getElementById('mainFrame');
div.style.height=window.document.body.scrollHeight||window.document.body.offsetHeight+5;
}
HTML怎么学习?HTML怎么入门?HTML在哪学?HTML怎么学才快?不用担心,这里为大家提供了HTML速学教程(入门课程),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号