js控制iframe高度
作者:互联网
1 <iframe src="test.html" id="iframeId" scrolling="no"></iframe>
1 function setIframeHeight() { 2 var iframe = document.querySelector("iframe"); 3 var ifr_document = iframe.contentWindow.document; 4 var iH = ifr_document.body.scrollHeight; 5 iframe.height = iH; 6 } 7 8 window.onload = function () { 9 setIframeHeight(); 10 }
标签:function,ifr,高度,js,iH,iframe,var,document 来源: https://www.cnblogs.com/rchi/p/12659184.html