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');(存在兼容性)