HTML document, documentElement , body 各对象.
2011-05-13 13:12
543 查看
document // Html 的容器对象.
document.documentElement //html 对象
document.body // body 对象
$(document.documentElement).find("body") ; // Body 对象.
各个高度有各个高度的含义.
document > document.documentElement > body .
但是 document.height 却很小.
试验:
<div style="margin: 1px 2px 3px 4px; padding: 5px 6px 7px 8px; border-top: 9px solid pink;
border-right: 10px solid pink; border-bottom: 11px solid pink; border-left: 12px solid pink;
background-color: green; height: 300px;">
<div style="height: 25px;background-color:Blue;">
</div>
<div class="FillHeight" style="margin: 13px 14px 15px 16px; padding: 17px 18px 19px 20px;
border-top: 21px solid pink; border-right: 22px solid pink; border-bottom: 23px solid pink;
border-left: 24px solid pink; background-color: Yellow;">
<asp:ContentPlaceHolder ID="MainContent" runat="server">
</asp:ContentPlaceHolder>
</div>
</div>
Height 就是 内容部分的高度.
outerHeight = Heigth + Border + Padding .
Offset 是按 outerHeight 的位置来计算的. 即= 边框左上角 的 Offset .
容器A
容器内要计算的对象B
B高 = A 高- B.Offset().top - B.marginBottom - B.Border - B.Padding
document.documentElement //html 对象
document.body // body 对象
$(document.documentElement).find("body") ; // Body 对象.
各个高度有各个高度的含义.
document > document.documentElement > body .
但是 document.height 却很小.
试验:
<div style="margin: 1px 2px 3px 4px; padding: 5px 6px 7px 8px; border-top: 9px solid pink;
border-right: 10px solid pink; border-bottom: 11px solid pink; border-left: 12px solid pink;
background-color: green; height: 300px;">
<div style="height: 25px;background-color:Blue;">
</div>
<div class="FillHeight" style="margin: 13px 14px 15px 16px; padding: 17px 18px 19px 20px;
border-top: 21px solid pink; border-right: 22px solid pink; border-bottom: 23px solid pink;
border-left: 24px solid pink; background-color: Yellow;">
<asp:ContentPlaceHolder ID="MainContent" runat="server">
</asp:ContentPlaceHolder>
</div>
</div>
Height 就是 内容部分的高度.
outerHeight = Heigth + Border + Padding .
Offset 是按 outerHeight 的位置来计算的. 即= 边框左上角 的 Offset .
容器A
容器内要计算的对象B
B高 = A 高- B.Offset().top - B.marginBottom - B.Border - B.Padding
相关文章推荐
- window、document、html、body、element的事件属性比较
- SD9013: 各浏览器对于 document、document.body、document.documentElement 对象的 onscroll 事件的支持存在差异
- window、document、html、body、element的事件属性比较
- 各浏览器对 document、document.body、document.documentElement 对象的 onscroll 事件支持情况
- 页面各元素位置和距离对象关系图解。 (深入document.documentElement、body.clentTop、div.scrollTop、div.scrollHeight、body.offsetWidth and so on)
- document.body为空或不是对象或者为什么获取不到document.documentElement.scrollHeight的值
- html事件绑定总结以及window.onload和document.body.onload事件
- 由document.body和document.documentElement想到的
- HTML DOM Element 对象之tagName
- HTML DOM Document 对象(转自w3cSchool)
- JS中document.documentElement和document.body
- document.body和document.documentElement的区别
- document.body.clientHeight与document.documentElement.clientHeight
- HTML DOM Document 对象
- 今晚作业:document.documentElement.scrollTop + document.body.scrollTop
- 一个禁止某个document element对象选中文本的js方法
- html document.getElement(s)By..
- jQuery JavaScript Library v1.6.1的$(document.body).append(html)不支持ie
- js判断document.getElementByid("")获得的对象是否存在
- document.documentElement和document.body的区别,以及网页中获取滚动条卷去部分的高度