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;
}
}
如何能爲好嗎?