JS左右层等高

[code]
<!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" c />
<title>练习文档01</title>
<style type="text/css">
<!--
body{
    margin:0px;padding:0px;
}
.Div_top{
width:100%;
background:#93beff;
}
.Div_bottom{
width:100%;
background:#ff00fc;
}
.Div_Left{
position:absolute;
width:200px;
background:#ff6000;
left:0px;
}
.Div_Right{
margin-left: 200px;
background:#00c17b;
}
-->
</style>
<script>
function SameH(leftDiv,rightDiv)
{
var a=document.getElementById(leftDiv);
var b=document.getElementById(rightDiv);document.write(a.clientHeight+'px');
document.write(b.clientHeight+'px');
document.write(a.scrollHeight+'px');
document.write(b.scrollHeight+'px');if (a.scrollHeight < b.scrollHeight)
{
a.style.height= b.scrollHeight;
}
else
{
b.style.height= a.scrollHeight;
}
}
</script></head>
<body>
<div class="Div_top">这是顶部的div</div>
<div id="Div1" class="Div_Left">11111<br>222222<br>33333333<br>444444444<br>555555555</div>
<div id="Div2" class="Div_Right">22222<br>dsaf</div>
<div class="Div_bottom">---------------------------------这是底部的DIV,在左中右中DIV不等高的情况下会跑上去重叠了<br>----------------------------------------我现在想用一个JavaScript代码来令左右两半的Div等高<br><br>(注意:中左中右两个DIV的高度是无法事先确定的)<br>为什么这个JavaScript在FireFox无效呢?</div>
<script>
SameH("Div1","Div2");
</script>
</body>
</html>

[code]把代码复制到Html页面里面,就会看到效果了
最后编辑Free_lins 最后编辑于 2008-08-20 10:15:57
身处当今繁芜浮燥的时代,人如飘萍,实在无法把握自己的明天。只好自己经营自己的心境,抚摸自己的孤独。有如临风奔命的鸟,停下来的时候,认真地对着一汪清水仔细地梳理着自己的羽毛。我常常是在寂寞中孤独地梳理着自己的思绪。用书来喂养自己的孤独;用音乐来平息内心汹