网页元素位置(scroll、client、offsetWidth等)获取、设置详解
2007-06-13 14:56
806 查看
[align=left]说明[/align]
[align=left]scrollHeight: 获取对象的滚动高度,也就是如果不带滚条动时,完全伸展时的高度。
scrollLeft:设置或获取位于对象左边界和窗口中目前可见内容的最左端之间的距离
scrollTop:设置或获取位于对象最顶端和窗口中可见内容的最顶端之间的距离
scrollWidth:获取对象的滚动宽度,也就是如果不带滚条动时,完全伸展时的宽度。
offsetHeight:获取对象相对于版面或由父坐标offsetParent 属性指定的父坐标的高度
offsetLeft:获取对象相对于版面或由 offsetParent 属性指定的父坐标的计算左侧位置
offsetTop:获取对象相对于版面或由 offsetParent 属性指定的父坐标的计算顶端位置
offsetWidth:获取对象相对于版面或由父坐标 offsetParent 属性指定的父坐标的宽度[/align]
[align=left]---------------------------------------------------------[/align]
[align=left]具体请看示例: (可以改变文本框的行数或拉到滚动条看数值变化):[/align]
[align=left]---------------------------------------------------------[/align]
welcome to: http://www.easewe.com 欢迎访问亿思维空间 http://www.easewe.com welcome to: http://www.easewe.com 欢迎访问亿思维空间 http://www.easewe.com welcome to: http://www.easewe.com 欢迎访问亿思维空间 http://www.easewe.com welcome to: http://www.easewe.com 欢迎访问亿思维空间 http://www.easewe.com welcome to:http://www.easewe.com 欢迎访问亿思维空间:http://www.easewe.com
[align=center]txtEaseWe.offsetHeight=100
txtEaseWe.clientHeight=81
txtEaseWe.scrollHeight=446
txtEaseWe.offsetLeft=230
txtEaseWe.clientLeft=1
txtEaseWe.scrollLeft=0
txtEaseWe.offsetTop=856
txtEaseWe.clientTop=1
txtEaseWe.scrollTop=365
txtEaseWe.offsetWidth=300
txtEaseWe.clientWidth=281
txtEaseWe.scrollWidth=281
txtEaseWe.offsetParent=[object][/align]
相关文章推荐
- document.body.offsetWidth 网页可见区域高宽,offset、client、scroll使用方法详解,页面位置距离
- CSS专题(二):元素大小与位置offsetLeft offsetTop offsetWidth offsetHeight clientWidth clientHeight scrollWidth s
- DOM获取元素位置的三大系列offset/scroll/client
- :元素大小与位置offsetLeft offsetTop offsetWidth offsetHeight clientWidth clientHeight scrollWidth scrollHei
- jquery获取设置元素宽高位置height()、width()、offset()、position()、scrollTop()、scrollLeft()
- CSS专题(二):元素大小与位置offsetLeft offsetTop offsetWidth offsetHeight clientWidth clientHeight scrollWidth s
- JS中offsetTop、clientTop、scrollTop、offsetTop各位置属性详解(含示例图)
- HTML:scrollLeft,scrollWidth,clientWidth,offsetWidth到底指的哪到哪的距离之完全详解
- 元素间距属性(scrollLeft,scrollWidth,clientWidth,offsetWidth,padding,margin)
- HTML精确定位:scrollLeft,scrollWidth,clientWidth,offsetWidth之完全详解
- scrollLeft,scrollWidth,clientWidth,offsetWidth之完全详解
- HTML精确定位:scrollLeft,scrollWidth,clientWidth,offsetWidth之完全详解
- HTML精确定位:scrollLeft,scrollWidth,clientWidth,offsetWidth等之完全详解
- HTML:scrollLeft,scrollWidth,clientWidth,offsetWidth之完全详解(转载)
- offset,client,scroll,getStyle获取元素宽高的区别
- scrollLeft,scrollWidth,clientWidth,offsetWidth 详解------备忘用!!!
- HTML精确定位:scrollLeft,scrollWidth,clientWidth,offsetWidth之完全详解
- (转)HTML精确定位:scrollLeft,scrollWidth,clientWidth,offsetWidth之完全详解
- HTML:scrollLeft,scrollWidth,clientWidth,offsetWidth 到底指的哪到哪的距离之完全详解
- HTML:scrollLeft,scrollWidth,clientWidth,offsetWidth之完全详解