iframe自适应高度

来源:互联网 发布:网络信息安全概述 编辑:程序博客网 时间:2024/05/21 22:26
    1. function iFrameHeight() {   
    2.     var ifm= document.getElementById("common"); //获得iframe,common为iframe的ID   
    3.     //document.frames['common'].document是IE6 IE7中的方法   
    4.     var subWeb = document.frames ? document.frames["common"].document : ifm.contentDocument;   
    5.     if(ifm != null && subWeb != null) {   
    6.         $(ifm).height(subWeb.body.scrollHeight);  
    7.     }   
    8. }  

0 0