<em id="hanht"></em>

    <dd id="hanht"></dd>

    <em id="hanht"><acronym id="hanht"></acronym></em>
    
    <button id="hanht"></button>
    <rp id="hanht"><object id="hanht"><blockquote id="hanht"></blockquote></object></rp><em id="hanht"></em>

    首頁 > 設計 > WEB開發 > 正文

    如何實現iframe(嵌入式幀)的自適應高度(2)

    2020-10-03 17:39:53
    字體:
    來源:轉載
    供稿:網友

    只要在嵌入式幀中head之間加上如下代碼,即可實現自適應高度:)測試有效。

    <SCRIPT language=javascript>
    function window.onload() {

    if(top.location != self.location){

    var a = window.parent.document.getElementsByTagName('iframe');

    for (var i=0; i<a.length; i++){

    if (a[i].name == self.name) {a[i].height = document.body.scrollHeight; return;}}}

    }
    </SCRIPT>

    發表評論 共有條評論
    用戶名: 密碼:
    驗證碼: 匿名發表