• iframe高度自适应


    var adjustIframe = function (id) {
        
    var iframe = document.getElementById(id)
        
    var idoc = iframe.contentWindow && iframe.contentWindow.document || iframe.contentDocument;
        
    var callback = function () {
            
    var iheight = Math.max(idoc.body.scrollHeight, idoc.documentElement.scrollHeight); //取得其高
            iframe.style.height = iheight + "px";
        }
        
    if (iframe.attachEvent) {
            iframe.attachEvent(
    "onload", callback);
        } 
    else {
            iframe.onload 
    = callback
        }
    }

    <iframe id="js_sub_web" width="80%" frameborder="0" scrolling="no" allowTransparency="true" src="http://www.qq.com">
    </iframe>

    window.onload 
    = function(){
         adjustIframe(
    "js_sub_web");
    }
  • 相关阅读:
    hdu 4864 Task
    hdu 1501 Zipper
    hdu 1428 漫步校园
    hdu 1505 City Game
    hdu 1337 The Drunk Jailer
    9-13记录
    python 读取unicode编码文件
    梯度出现Nan值的追踪
    Rstudio-server更改R版本
    stdout/stderr作用学习
  • 原文地址:https://www.cnblogs.com/wuye1200/p/2082359.html
Copyright © 2020-2023  润新知