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

mac2022-06-30  107

 

引用:

<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) { } }

  

转载于:https://www.cnblogs.com/bxbz/p/4643290.html

最新回复(0)