0
请帮我,自动iframe的高度
的第一次iframe的高度正在改变,因为每所装载的高度,但在iframe的内容更改为更大的高度比现在又一次地降低其不具有新的价值。
例如 加载iframe的高度= 1386px 新的内容变化iframe的高度= 3440px 并再次更改到新的高度= 3440px(但实际高度是非常小的比1300px)
这就是我试图
$('iframe').load(function()
{
document.getElementById('loaderIFRAME').style.display = 'none';
document.getElementById('myiframe').style.display = 'block';
// Set inline style to equal the body height of the iframed content.
if($.browser.msie){
this.style.height = this.contentWindow.document.body.scrollHeight + 'px';
}else{
this.style.height = this.contentWindow.document.body.scrollHeight + 'px';
}
}
,另一个也同样
function autoIframe(frameId) {
try{
frame = document.getElementById(frameId);
innerDoc = (frame.contentDocument) ? frame.contentDocument : frame.contentWindow.document;
objToResize = (frame.style) ? frame.style : frame;
objToResize.height = innerDoc.body.scrollHeight + 10+ 'px';
alert(objToResize.height);
}
catch(err){
window.status = err.message;
}
}
如何能为好吗?