< meta http-equiv="Content-Type" Content="text/html; charset=utf-8">
< textarea wrap="off" onmouseover=
"alert(' clientWidth:'+this.clientWidth+
'\n offsetWidth:'+this.offsetWidth+'\n scrollWidth:'+this.scrollWidth);">
11111111111111111111111111111
< /textarea>
clientWidth是对象看到的宽度(不含边线)
offsetWidth是对象看到的宽度(含边线,如滚动条的占用的宽,值会随着内容的输入而不断改变)
scrollWidth是对象实际内容的宽度。
手册里面说的并不是很清楚,可以根据上面的例子加深理解。
clientWidth语法:
Scripting [ iWidth = ] object.clientWidth
clientWidth的值:
iWidth Integer that receives the width of the object, in pixels.
(以像素为单位显示对象的宽度)
offsetWidth语法:
Scripting [ iWidth = ] object.offsetWidth
offsetWidth的值:
iWidth Integer that receives the width, in pixels.
(以像素为单位显示宽度)
scrollWidth语法:
Scripting [ iWidth = ] object.scrollWidth
scrollWidth的值:
iWidth Pointer to a nonnegative long integer that specifies the width, in pixels.
(以像素为单位显示一个非负长整型的宽度值)
分享到:
相关推荐
HTML:scrollLeft,scrollWidth,clientWidth,offsetWidth完全详解
scrollWidth,clientWidth与offsetWidth的区别
JavaScript属性scrollLeft,scrollWidth,clientWidth,offsetWidth之完全详解
主要介绍了scrollWidth,clientWidth,offsetWidth的区别,需要的朋友可以参考下
图示offsetWidth、clientWidth、scrollWidth、scrollTop、scrollLeft等属性,对于一些页面的控制很有帮助。
javascript scrollLeft,scrollWidth,clientWidth,offsetWidth 完全详解,实例修正版。
scrollWidth:获取对象的滚动宽度 offsetHeight:获取对象相对于版面或由父坐标 offsetParent 属性指定的父坐标的高度 offsetLeft:获取对象相对于版面或由 offsetParent 属性指定的父坐标的计算左侧位置 offsetTop:...
网页可见区域宽: document.body.offsetWidth (包括边线和滚动条的宽); 网页可见区域高: document.body.offsetHeight (包括边线的宽); 网页正文全文宽: document.body.scrollWidth; 网页正文全文高: document....
四种浏览器对_clientHeight、offsetHeight、scrollHeight、clientWidth、offsetWidth_和_scrollWidth_的解
网页可见区域宽: document.body.clientWidth; 网页可见区域高: document.body.clientHeight; 网页可见区域宽: document.body.offsetWidth (包括边线的宽); 网页可见区域高: document.body.offsetHeight (包括...
关于js中的offsetWidth、clientWidth、scrollWidth等一系列属性及其方法一直都傻傻分不清,这里就来总结一下这些方法的用法和含义。 一、clientWidth和clientHeigh 、 clientTop和clientLeft 1,clientWidth的实际...
1. 正确理解offsetWidth、clientWidth、scrollWidth及相应的height属性 假设某一个元素的横纵向滚动条都拖动到最末端,则offsetWidth、clientWidth、scrollWidth等属性相应的范围如下图所示: 1)offsetWidth ,...
网页可见区域宽:document.body.clientWidth 网页可见区域高:document.body.clientHeight 网页可见区域宽:document.body.offsetWidth (包括边线的宽) 网页可见区域高:document.body.offsetHeight (包括边线的宽) ...
网页可见区域宽:document.body.clientWidth 网页可见区域高:document.body.clientHeight 网页可见区域宽:document.body.offsetWidth (包括边线的宽) 网页可见区域高:document.body.offsetHeight (包括边线的宽) ...
第二组:clientWidth,clientHeight,clientLeft,clientTop 第三组:scrollWidth,scrollHeight,scrollLeft,scrollTop 详细定义如下: 1.1 HTML元素的offsetWidth,offsetHeight以CSS像素返回
网页可见区域宽:document.body.clientWidth 网页可见区域高:document.body.clientHeight 网页可见区域宽:document.body.offsetWidth (包括边线的宽) 网页可见区域高:document.body.offsetHeight (包括边线的宽) ...
网页可见区域宽:document.body.clientWidth 网页可见区域高:document.body.clientHeight 网页可见区域宽:document.body.offsetWidth (包括边线的宽) 网页可见区域高:document.body.offsetHeight (包括边线的宽) ...
网页可见区域宽:document.body.clientWidth 网页可见区域高:document.body.clientHeight 网页可见区域宽:document.body.offsetWidth (包括边线的宽) 网页可见区域高:document.body.offsetHeight (包括边线的宽) ...