<script type="text/javascript">
document.getElementById("div1").style.height=document.getElementById("zg").scrollHeight+"px";
document.getElementById("div2").style.height=document.getElementById("zg").scrollHeight-2+"px";
</script>
<div id="zg">
<div id="div1"></div><div id="div2"></div>
</div>