不晓得你的操作B,C是啥意思
是指改变B,C框架大小吗?
类似操作frameset的cols,rows?
window.parent.document.getElementsByTagName("frameset")[0].cols="200,*";

解决方案 »

  1.   

    http://bolm.cn/blog/?p=184简单方法让iFrame自适应高度
      

  2.   

    a.html
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
            <title>Untitled Document</title>
        </head>
        <script language="JavaScript">
            function $(id){
                return document.getElementById(id);
            }
            
            function test(){
                alert(0);
            }
            
        </script>
        <body>
            <iframe id="f" src="b.html" frameborder=1 scrolling="no">
            </iframe>
    <hr>
    <h1>a.html</h1>
        </body>
    </html>
    b.html
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
            <title>Untitled Document</title>
        </head>
        <script language="JavaScript">
            function $(id){
                return document.getElementById(id);
            }
            
            window.onload = window.onresize = setFrameSize;
            function setFrameSize(){
                parent.$("f").style.width = document.body.scrollWidth + 12 + "px";
                parent.$("f").style.height = document.body.scrollHeight + 12 + "px";
            }
            
            function test(){
                var o = $("div1");
                
                if (o.style.display == "none") {
                    o.style.display = "block";
                }
                else {
                    o.style.display = "none";
                }
            }
        </script>
        <body topmargin=5 rightmargin=5 leftmargin=5 bottommargin=5>
            <input type="button" value="test" onclick="test();"><hr>
            <iframe id="f" src="c.html" frameborder=1 scrolling="no">
            </iframe>
            <div id="div1" style="background:blue;width:400px;height:200px;display:none;">
            </div>
            <hr><h1>b.html</h1>
        </body>
    </html>
    c.html
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
            <title>Untitled Document</title>
        </head>
        <script language="JavaScript">
            function $(id){
                return document.getElementById(id);
            }
            
            window.onload = window.onresize = setFrameSize;
            function setFrameSize(){
                parent.$("f").style.width = document.body.scrollWidth + 12 + "px";
                parent.$("f").style.height = document.body.scrollHeight + 12 + "px";
            }
            
            function test(){
                var o = $("div1");
                
                if (o.style.display == "none") {
                    o.style.display = "block";
                }
                else {
                    o.style.display = "none";
                }
            }
        </script>
        <body topmargin=5 rightmargin=5 leftmargin=5 bottommargin=5>
            <input type="button" value="test" onclick="test();"><hr>
            <div id="div1" style="background:red;width:600px;height:100px;display:none;">
            </div>
            <hr><h1>c.html</h1>
        </body>
    </html>
      

  3.   

    当window.onload和window.onresize的时候计算应该需要的大小
      

  4.   

    当window.onload和window.onresize的时候计算应该需要的大小
      

  5.   

     <IFRAME  border=0 name=content  src="index_main.aspx" frameBorder=0  width=js 函数 
    scrolling=auto //这个很重要onload=this.height=js 函数 target="_blank"></IFRAME>