admin管理员组文章数量:1566356
function reloadFrameHeightShow(){
var height = $("#mainContent7").contents().find("#wrap").height();
$("#mainContent7").height(height);
window.parent.reloadFrameHeight();
}
千万不要写load
xxxxxxxx
function reloadFrameHeight(){
$("#mainContent7").load(function(){
var height = $(this).contents().find("body").height();
$(this).height(height);
window.parent.reloadFrameHeight();
})
}
xxxxxxxx
最近项目的一个iframe的使用
父页面写
function reloadFrameHeight(){
$("#myEmailIframe").load(function(){
var height = $(this).contents().height();
$(this).height(height);
})
}
子页面在加载完内容后调用父页面的reloFrameHeight()方法
window.parent.reloadFrameHeight();
-----------------------------------------------------
但是不支持firefox火狐浏览器,断章取义的,说明一下是因为 火狐浏览器不能在往页面注入内容后 获取页面的高度,必须是页面加载完毕之后才能获取内容高度。
支持firefox的方法
父页面写
$(fucntion(){
setTimeout('reloadFrameheight()',3000);
})
fucntion reloadFrameHeight(){
var height=$("#myEmailIframe").contents().find('body').height();
$("myEmailIframe").height(height);
}
子页面不需要写任何东西
-----------------------------------------------------
.hddc_xz a{} 控制class后面的a标签
<td class="hddc_xz" id="class" ><a href="training_course_announcement_main.jsp?class_info_id=<%=request.getParameter("class_info_id")%>" target="main" id="0" οnclick="changeStyle(this,'class');">班级信息</a></td>
版权声明:本文标题:控制iframe高度的万能方法 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/xitong/1726975467a1092736.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论