在整个body窗体中.document.body.offsetWidth 比 document.body.clientWidth 多出一点儿偏移.我理解的是滚动条的宽度吧(你看右边的滚动条,在滚动条以内的就是document.body.clientWidth,加上两边的滚动条(当然有可能没有出现,如左边的),就是document.body.offsetWidth)
解决方案 »
- 散分讲论:WEB开发的未来
- 问一下如何让onclick事件加一个自定义值
- PNG透明用JS兼容成功后,图片上的锚点链接却失效了!求助!
- onmouseover事件绑定问题,求解!
- google地图问题
- 请教用JS检测UpdatePanel 中的DataList 中的 CheckBoxList 是否有被选中,无选中则弹出提示框?
- javascript 给TD添加子控件的问题,求救
- 定时器setTimeout的问题。。。。
- 关于javascript做伸缩菜单,却无法实现伸缩效果。
- http://expert.csdn.net/Expert/topic/1679/1679753.xml?temp=.6142084
- "ForReading" 未定义的错误?
- 一个文本筐只能输入从n到m的整数,怎么写?
--------------------------------------------------------------------------------
Retrieves the width of the object including padding, but not including margin, border, or scroll bar.offsetWidth Property
--------------------------------------------------------------------------------
Retrieves the width of the object relative to the layout or coordinate parentexample:
<DIV ID=oDiv STYLE="overflow:scroll; width:200; height:100">This example shows the difference between
the dimension retrieved by the <B>clientWidth</B> and the dimension retrieved by the <B>offsetWidth</B>, the latter
including the width of scrollbars.</DIV>
<BUTTON onclick="alert(oDiv.clientWidth)">client width</BUTTON>
<BUTTON onclick="alert(oDiv.offsetWidth)">offset width</BUTTON>