您的位置:首页 > 其它

ff chrome和ie下全局动态定位的异同及全局高度的取法

2014-06-30 00:00 330 查看
DTD已声明

IE

document.documentElement.scrollHeight 浏览器所有内容高度 ,document.body.scrollHeight 浏览器所有内容高度

document.documentElement.scrollTop 浏览器滚动部分高度,document.body.scrollTop 始终为0

document.documentElement.clientHeight 浏览器可视部分高度,document.body.clientHeight 浏览器所有内容高度
FF

document.documentElement.scrollHeight 浏览器所有内容高度 ,document.body.scrollHeight 浏览器所有内容高度

document.documentElement.scrollTop 浏览器滚动部分高度,document.body.scrollTop 始终为0

document.documentElement.clientHeight 浏览器可视部分高度,document.body.clientHeight 浏览器所有内容高度
Chrome

document.documentElement.scrollHeight 浏览器所有内容高度, document.body.scrollHeight 浏览器所有内容高度

document.documentElement.scrollTop 始终为0,document.body.scrollTop 浏览器滚动部分高度

document.documentElement.clientHeight 浏览器可视部分高度,document.body.clientHeight 浏览器所有内容高度
DTD未声明

IE

document.documentElement.scrollHeight 浏览器可视部分高度,document.body.scrollHeight 浏览器所有内容高度

document.documentElement.scrollTop 始终为0,document.body.scrollTop 浏览器滚动部分高度

document.documentElement.clientHeight 始终为0,document.body.clientHeight 浏览器可视部分高度
FF

document.documentElement.scrollHeight 浏览器可视部分高度, document.body.scrollHeight 浏览器所有内容高度

document.documentElement.scrollTop 始终为0,document.body.scrollTop 浏览器滚动部分高度

document.documentElement.clientHeight 浏览器所有内容高度,document.body.clientHeight 浏览器可视部分高度
Chrome

document.documentElement.scrollHeight 浏览器可视部分高度,document.body.scrollHeight 浏览器所有内容高度

document.documentElement.scrollTop 始终为0,document.body.scrollTop 浏览器滚动部分高度

document.documentElement.clientHeight 浏览器所有内容高度,document.body.clientHeight 浏览器可视部分高度
浏览器所有内容高度即浏览器整个框架的高度,包括滚动条卷去部分+可视部分+底部隐藏部分的高度总和

浏览器滚动部分高度即滚动条卷去部分高度即可视顶端距离整个对象顶端的高度。

DTD声明,指的是浏览器页面载入时候的声明:<!DOCTYPE html public ""....>

声明文档类型html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: