һַԻԣҿȲ¡
ƴ :
function SetWinHeight(obj)
{
var win=obj;
if (document.getElementById)
{
if (win && !window.opera)
{
if (win.contentDocument && win.contentDocument.body.offsetHeight)
win.height = win.contentDocument.body.offsetHeight;
else if(win.Document && win.Document.body.scrollHeight)
win.height = win.Document.body.scrollHeight;
}
}
}
iframe,ܶonloadԣȻˣidҲҲеwinƥ
ƴ :
ôҲǸĽƵĴ
iFrame Ӧ߶ȣIE6/IE7/IE8/Firefox/Opera/Chrome/Safariͨԡ
HTML룺
ƴ :
Javascript룺
ԸһЩ
ƴ :
һiframe
Ҫʾsrc=дҳַһҪͱҳͬһվϣᱧ˵ܾʣ(ʵΪJsĿ¾ܾʵ)
֮ǰԼҲ⣬Ϊ˵õȥвҲ⣬ھͰѽһ
1һbottom.jsļȻĴ루ֻŶ
ƴ :
parent.document.all("ID").style.height=document.body.scrollHeight;
parent.document.all("ID").style.width=document.body.scrollWidth;
ID IframeID磺
ƴ :
2վеıļÿ
ƴ :
3OKչ
WINXPIE6ܼͨɣ
ʵ iframe Ӧ߶
ʵ iframe Ӧ߶ȣܹҳijԶӦҳ iframe ͬʱֹ
ƴ :
зiframeӦ
iframeӦ߶ȵ⣬ǰϿĽһ£ҵһȽܹĽʡԼдˡ
ȻԼд˼·ҪףϾȡiframesrcָİĵݵĸ߶ȣȻiframeĸ߶ȣ iframeҳʱҳеҪӦ߶ȵiframeԶãʡʱʡȷҳȫiframeҪӦ߶ȣֱȡiframe룬IDԼдˣɳ㶨
ƴ :
˸Ľ˷˵iframeĵݸ߶ȶ̬仯ʱԶiframe߶ȵ⣬ԭiframeҳ治ɨ iframeĵݸ߶Ȳıiframe߶ȣַòƽ⣬ǶҳٶȺϵͳԴռǷӰ컹˵оЩƫִӦиõĽ
ַֻ֪iframeID Ƽ
ƴ :
function iframeAutoFit(iframeObj){
setTimeout(function(){if(!iframeObj) return;iframeObj.height=(iframeObj.Document?iframeObj.Document.body.scrollHeight:iframeObj.contentDocument.body.offsetHeight);},200)
}