• 想框架自动适应内页的高度吗?用这行代码吧!


    <script type="text/javascript">
    var iframeids=["test"]
    var iframehide="yes"
    function dyniframesize()
    {
      var dyniframe=new Array()
      for (i=0; i<iframeids.length; i++)
      {
       if (document.getElementById)
       {
        dyniframe[dyniframe.length] = document.getElementById(iframeids[i]);
        if (dyniframe[i] && !window.opera)
        {
         dyniframe[i].style.display="block"
         if (dyniframe[i].contentDocument && dyniframe[i].contentDocument.body.offsetHeight)
          dyniframe[i].height = dyniframe[i].contentDocument.body.offsetHeight;
         else if (dyniframe[i].Document && dyniframe[i].Document.body.scrollHeight)
          dyniframe[i].height = dyniframe[i].Document.body.scrollHeight;
        }
       }
       if ((document.all || document.getElementById) && iframehide=="no")
       {
        var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
        tempobj.style.display="block"
       }
      }
    }

    if (window.addEventListener)
    window.addEventListener("load", dyniframesize, false)
    else if (window.attachEvent)
    window.attachEvent("onload", dyniframesize)
    else
    window.onload=dyniframesize
    </script>


    实例
    <iframe id="test" name="main" src="http://www.woidea.net" width="100%" border="0" vspace="0" hspace="0" marginwidth="0" marginheight="0" framespacing="0" frameborder="0" scrolling="no"></iframe>
  • 相关阅读:
    HTTP状态码
    NSData NSDate NSString NSArray NSDictionary 相互转换
    NSDictionary to jsonString || 对象转json格式
    git 上传本地文件到github
    NSAssert用法
    深入理解GCD(一)
    ug-Assertion failure in [MyClass layoutSublayersOfLayer:]
    构建之法阅读笔记01
    学习进度
    四则运算程序
  • 原文地址:https://www.cnblogs.com/it563/p/605802.html
Copyright © 2020-2023  润新知