zoukankan      html  css  js  c++  java
  • iframe切换内容页仍然能自适应大小代码(含js)

    function setIframeHeight(iframe) {
                  if (iframe) {
                      var iframeWin = iframe.contentWindow || iframe.contentDocument.parentWindow;
                      if (iframeWin.document.body) {
                          iframe.height = iframeWin.document.documentElement.scrollHeight || iframeWin.document.body.scrollHeight;
                      }
                  }
                };
                window.onload = function () {
                    setIframeHeight(document.getElementById('myiframe'));//iframe的id
    }; 


    <iframe onload="setIframeHeight(this)" id="myiframe" name="item-ifram" class="ZhaoShangJiaMeng-ifram" src="ZhaoShangJiaMeng-QuanYi.html" frameborder="0" scrolling="no" ></iframe>
  • 相关阅读:
    浅谈生成全排列的4种方法
    UVA
    UVA
    UVA
    UVA
    MySQL索引篇
    MySQL事务篇
    MySQL架构篇
    Redis性能调优
    Redis分布式锁
  • 原文地址:https://www.cnblogs.com/shark1100913/p/5729948.html
Copyright © 2011-2022 走看看