摘要:IFrame resize II
之前iframe1.height=document.body.scrollHeight太偷懶了,他不是真正我們要的會依ifram內容去動態定義出高度
(他只是照body的scroll height = =|)
所以又改寫一下讓他可以顯示真正的高度。
<iframe id="iframe1" onload="javascript:{resize('iframe1');}" marginwidth="0" marginheight="0" frameborder="0" scrolling="no"
width="100%" height="100 %" src="http://vmxr7/MXIC/Announcement.nsf/7245E2186733FEFB482576B9002EE3DD"></iframe>
function resize(FramID)
{
//parent.document.getElementById(FramID).height=document.body.scrollHeight;
//document.getElementById('iframe1').height=document.body.scrollHeight;
var Framobj=document.getElementById(FramID);
if (document.getElementById){
if (Framobj && !window.opera){
if (Framobj.contentDocument && Framobj.contentDocument.body.offsetHeight){
Framobj.height = Framobj.contentDocument.body.offsetHeight;
}else if(Framobj.Document && Framobj.Document.body.scrollHeight){
Framobj.height = Framobj.Document.body.scrollHeight;
}
}
}
}