?
<html> <body> <div id="test"> </div> <div> <input type="button" onclick="test()" value="float"/> </div> <script> var div = document.getElementById("test"); alert(div.scrollWidth); function test(){ div.style.cssFloat = "left"; alert(div.scrollWidth); } </script> </body> </html>
?
?chrom,ff下页面初始时弹出:1424
?点击按钮之后chrome,ff弹出:0
/***************************/
ie浏览器页面初始时弹出1424
点击按钮之后ie仍旧弹出:1424(服了)
?
?
/****************************/
?
scrollWidth scrollHeight
给出设置了overflow:visible的元素总的宽度和高度。如果这个宽度和高度大于clientWidth和clientHeight,该元素就需要滚动条。
width + padding + border
overflow:hidden/scroll 时 ,所有浏览器都会返回该元素的全部显示时的值
overflow:visible 时,google chrome、Safari、IE会显示元素全部显示时的值,而FF、Opera会显示应当显示的区域的值
该属性有很多的Bug,所以在具体应用时,用处很少