div 底部


<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body style="margin:0px; padding:0px;">
<div id="div1" style="height:128px; background-color:red;"> sdfsdf<br><br>fsdf<br>fsdf</div>
<div id="div2" > sdfsdf<br><br>fsdf<br>fsdf</div>

<div id="div3" style="height:144px;background-color:blue;"> sdfsdf<br><br>fsdf<br>fsdf</div>

</dody>

<script>
alert(div1.offsetHeight);
alert(div2.offsetHeight);
alert(div3.offsetHeight);
alert(document.body.clientHeight);

if((div1.offsetHeight + div2.offsetHeight + div3.offsetHeight )<window.document.body.clientHeight)
{
div2.style.height= ( window.document.body.clientHeight- div1.offsetHeight-div3.offsetHeight )+"px";
}
</script>
</html>

posted @ 2008-05-09 06:44  风轻如梦  阅读(448)  评论(0编辑  收藏  举报