zoukankan      html  css  js  c++  java
  • Iframe自动适应宽度和高度(both IE and Firefox )

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>iframe</title>
    </head>
    <body>
    <script type="text/javascript">
     
    function SetCwinHeight(){
      
    var bobo=document.getElementById("bobo"); //iframe id
      if (document.getElementById){
       
    if (bobo && !window.opera){
        
    if (bobo.contentDocument && bobo.contentDocument.body.offsetHeight){
         bobo.height 
    = bobo.contentDocument.body.offsetHeight;
        }
    else if(bobo.Document && bobo.Document.body.scrollHeight){
         bobo.height 
    = bobo.Document.body.scrollHeight;
        }
       }
      }
     }
    </script>
    <iframe width="100%" id="bobo" onload="Javascript:SetCwinHeight()" height="1" frameborder="0" src="IFrame_myPage.aspx"></iframe>
    这里有什么?
    </body>
    </html>

    还有一种方法是不需要js控制的。与大家分享一下

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
     上面是必须要替换的  (如果是想尝试一下 就Ctrl+C and Ctrl+V 一下。。。)      

    <table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
                <tr height="100%">
                    <td valign="top">
                        <iframe id="Iframe1" width="100%" height="100%" scrolling="no" frameborder="0" src="FrmDWJJJS.aspx?id=<%= id%>">
                        </iframe>
                    </td>
                </tr>
                       </table>

  • 相关阅读:
    redis五中数据类型
    MySQL索引
    mysql中如何设计计数器表(待续)
    mysql 数据类型选择原则
    1.开篇(听说你还在艰难的啃react源码)
    关于wamp的HTML, PHP, mysql 三者的操作与联系
    关于wamp的HTML, PHP, mysql 三者的操作与联系
    关于wamp的HTML, PHP, mysql 三者的操作与联系
    SQL server T-sql语句查询执行顺序
    SQL server T-SQL索引详解
  • 原文地址:https://www.cnblogs.com/xinlang/p/1325554.html
Copyright © 2011-2022 走看看