document对象

1. document 表明整个文档流html

    document.documentElement: 表明htmlurl

    document.body :表明 bodyhtm

    (在获取文档高度相关参数时,二者同时使用用于ie的兼容,如scrollHeight =document.documentElement.scrollTop || document.body.scrollTop )对象

    注:默认html,body 的min高度(不考虑margin)为窗口可视区高度,并随内容增大而增大文档

2. clientHeight,offsetHeight的区别字符串

    clientHeight :表明元素的内容+内边距(client,客户的意思,从元素的角度看)string

    offsetHeight :表明元素的clientHeight + 边框的宽度(从元素的有定位的父元素看)域名

    

    clientTop: 容器内部相对于容器自己的top偏移,实际就是 上border-widthio

    scrollTop: Y轴的滚动条没有,或滚到最上时,是0;y轴的滚动条滚到最下时是容器

                    scrollHeight-clientHeight

    offsetTop: 能够理解为容器相对于document的top的绝对偏移。等于top+margin-top

 

3. location对象

    document.location==location

        host:有端口号的域名,hostname : 不包含端口

    location对象能够和方便的获取url中的参数,如果想要分析其余的url字符串,可使用URL对象,如:

    var myLocation = new URL('url string');(存在兼容性)

相关文章
相关标签/搜索