菜单

Iframe适应高度

2019年01月22日 - javascript
  1. <script type="text/javascript">
  2. function reinitIframe() {
  3. var iframe = document.getElementById("form-iframe");
  4. try {
  5. var bHeight = iframe.contentWindow.document.body.scrollHeight;
  6. var dHeight = 900;
  7. var height = Math.max(bHeight, dHeight);
  8. iframe.height = height;
  9. } catch (ex) {}
  10. }
  11. window.setInterval("reinitIframe()", 200);
  12. </script>
<script type="text/javascript"> 
        function reinitIframe() {
          var iframe = document.getElementById("form-iframe");
          try {
            var bHeight = iframe.contentWindow.document.body.scrollHeight;
            var dHeight = 900;
            var height = Math.max(bHeight, dHeight);
            iframe.height = height;
          } catch (ex) {}
        }
        window.setInterval("reinitIframe()", 200);
</script>

 

发表评论

电子邮件地址不会被公开。 必填项已用*标注

读取中