【发布时间】:2012-02-08 03:15:34
【问题描述】:
有什么办法可以改变身高。我试过了:
if(document.body.scrollHeight > document.getElementById('DIVBODY').scrollHeight) {
document.body.scrollHeight = document.getElementById('DIVBODY').scrollHeight
}
但它不起作用。 我动态更改我的 DIVBODY 内容,我不希望我的 DIVBODY 比 div 大。
body 和 div:
<body background="images/grey-lines.png" style="overflow-y:scroll" >
<div id="DIVBODY" style="max-width:1102px; margin: auto; width: expression( Math.min(parseInt(this.offsetWidth), 1102) ); height:100%; text-align:center; align:center;
background-image: url(bg/wood-3.jpg) ; background-color:#af7746; background-attachment:fixed; background-position: top center ; background-repeat: repeat; border-left: 1px solid black; border-right: 1px solid black; height: auto; min-height: 100%; _height: 100%;">
【问题讨论】:
-
请在“IF”之前简单显示 document.body.scrollHeight 和 document.getElementById('DIVBODY').scrollHeight 以进行调试
标签: javascript html height document-body