宽度与高度


Warning: Undefined array key "HTTP_REFERER" in /www/wwwroot/prod/www.enjoyasp.net/wp-content/plugins/google-highlight/google-hilite.php on line 58
宽度与高度
1,offsetTop、offsetLeft、offsetWidth、offsetHeight
offsetTop、offsetLeft:指 obj 相对于版面或由 offsetParent 属性指定的父坐标的计算上侧、左侧位置。
offsetWidth、offsetHeight:obj.offsetWidth 指 obj 控件自身的绝对宽度、高度,不包括因 overflow 而未显示的部分。

2,scrollTop、scrollLeft、scrollWidth、scrollHeight
*scrollTop、scrollLeft :滚动条卷起来的高度值及左值。
*scrollWidth、scrollHeight:是内层元素的实际宽度、高度 + 外层元素 padding(包括因 overflow 而未显示的部分)

3,clientHeight 与 clientWidth:是document.body内容可视区域的高度、宽度,也就是说页面浏览器中可以看到内容的这个区域的高度、宽度

4,window.screen.height与window.screen.width:指屏幕分辨率的高与屏幕分辨率的宽  。clientHeight+浏览器工具条的高度与screen.height相近。

注:1,offsetTop与top的区别:

* offsetTop 返回的是数字,而 style.top 返回的是字符串,除了数字外还带有单位:px。
* offsetTop 只读,而 style.top 可读写。


例:定位于右下角:




Watermark

.........