`

iframe自适应高度

 
阅读更多
function reinitIframe()
          {
            var iframe = document.getElementById("menu");
            iframe.height='500px';
            try
            {
                var bHeight = iframe.contentWindow.document.body.scrollHeight ;
                 var dHeight = iframe.contentWindow.document.documentElement.scrollHeight ;
                 var height = Math.max(bHeight, dHeight); 
                  iframe.height = height;
            }
            catch (ex){}
         } 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics