style.width,offsetWidth,clientWidth,scrollWidth的区别


 style.width,offsetWidth,clientWidth,scrollWidth中只有style.width是可读写,其它都只是可读

其中style.width,offsetWidth是差不多的,style.width的值带单位而offsetLeft不带单位。

 

style.width:  获取或设置 width + padding + border

offsetWidth:   获取 width + padding + border

clientWidth:  获取 width + padding
scrollWidth:  获取 对象的滚动宽度

 


 

posted @ 2015-09-26 17:13  Byronvis  阅读(227)  评论(0编辑  收藏  举报