以前遇到过 没有想到其他办法 只有使用古老的方式..如下<!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=gb2312" />
<title>无标题文档</title>
</head>
<body>
<input name="" type="button" value="aaa" onclick="aa()" />
<script>
var text="<div id='ddd' style='width:200px; height:300px; border:1px solid #000000;'><div style='width:100%; height:100%; background:#000000;'> </div></div>";
function aa(){
document.write(text);
}
aa();
</script>
</body>
</html>

解决方案 »

  1.   

    this?<!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=gb2312" />
    <title>无标题文档</title>
    </head>
    <body>
    <input type="button" value="像素" onclick="aa()" />
    <div id="ddd" style="width:200px; height:200px;border:1px solid #000000;background:#cccccc;" ></div>
    </body>
    <script>
    function aa(){
    document.getElementById("ddd").style.height = "400"+"px";
    document.getElementById("ddd").style.background = "#cccccc";
    }
    </script>
    </body>
    </html>
      

  2.   

    ls的跟我那个不同吧
    我那个是两个div
      

  3.   

    五楼的可以呀.
    两个DIV一样.
      

  4.   


    <!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=gb2312" />
    <title>无标题文档</title>
    </head>
    <body>
    never-online.net
    <input name="" type="button" value="aaa" onclick="aa()" />
    <div id="ddd" style="width:200px; height:200px;" style="border:1px solid #000000;overflow:hidden;">
    <div style="width:100%; height:100%; background:#000000;"> </div>
    </div>
    <script>
    function aa(){
    document.getElementById("ddd").style.height = "300px"
    }
    </script>
    </body>
    </html>
      

  5.   

    在外层CSS上加overflow就可以了
      

  6.   

    出现这个问题的原因是因为IE6渲染的问题,通过某些CSS的属性可以让DOM改变之后再次渲染。
      

  7.   

    楼上正解!<!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=gb2312" />
    <title>无标题文档</title>
    </head>
    <body>
    <input type="button" value="像素" onclick="aa()" />
    <div id="ddd" style="width:200px; height:200px;border:1px solid #000000;background:#cccccc; overflow:hidden" >
    <div style="background-color:#0099CC; height:100%; width:100%">
    </div>
    </div>
    </body>
    <script>
    function aa(){
    document.getElementById("ddd").style.height = "400"+"px";
    document.getElementById("ddd").style.background = "#cccccc";
    }
    </script>
    </body>
    </html>
      

  8.   

    在高度调整后,对要响应100%高度的标签直接重新设定为100%;就可以让IE6像IE8一样,成功响应自适应高度
     
    node.style.height = 'auto'; node.style.height = '100%';
    当然,如果要同整个窗口保持同高,就必须要以下样式咯
    html,body{height:100%;}