第一句应改为(另外,不要用关键字iframe、body命名ID)
document.getElementById("iframe").style.height=document.getElementById("iframe").contentWindow.document.getElementById("body").style.height;
第二句是IE专用的。也就是说在其他非IE内核的浏览器中会报错。
document.getElementById("iframe").style.height=document.getElementById("iframe").contentWindow.document.getElementById("body").style.height;
第二句是IE专用的。也就是说在其他非IE内核的浏览器中会报错。
iframe用document.frames["iframe"]
得到的都是frame内嵌的windowdocument.getElementById("iframe")得到的是iframe控件
document.getElementById("iframe").contentWindow也能得到iframe控件内嵌的window
但ie专用