document.compatMode:有两种可能的返回值:BackCompat和CSS1Compat,对其解释如下:
BackCompat: Standards-compliant mode is not switched on. (Quirks Mode)
CSS1Compat: Standards-compliant mode is switched on. (Standards Mode)
//判断是否是ie
isIE=document.all && !window.opera;
var iebody = document.compatMode && document.compatMode != 'BackCompat'
? document.documentElement : document.body;
当文档有了标准声明时, document. compatMode 的值就等于 "CSS1compat", 因此, 我们可以根据 document. compatMode 的值来判断文档是否加了标准声明
var
height
=
document.compatMode
==
"
CSS1Compat
"
?
document.documentElement.clientHeight : document.body.clientHeight;