iframe 如何让它展现内容自适应高度

 

引用:

 <iframe id="ifm1" runat="server" src="/comment/page1?id=@productId" width="100%" height="100%"  frameborder="0" border="0" marginwidth="0" marginheight="0" scrolling="no" allowtransparency="no" ></iframe>

js:

   function reinitIframe() {
        var iframe = document.getElementById("ifm1");
        try {
            iframe.height = iframe.contentWindow.document.documentElement.scrollHeight;
        } catch (ex) { }
    }

  

posted @ 2015-07-13 16:40  无言的蜗牛  阅读(289)  评论(0编辑  收藏  举报