您的位置:首页 > 其它

document.compatMode介绍

2013-01-04 16:00 309 查看
document.compatMode 检查当前的文档渲染模式

返回值:BackCompat和CSS1Compat;

IE对两种模式渲染差别很大;

BackCompat: Standards-compliant mode is not switched on. (Quirks Mode) //默认模式

CSS1Compat: Standards-compliant mode is switched on. (Standards Mode) //标准模式

例子:

alert(document.body.clientWidth + '-' + document.documentElement.clientWidth + '-' + document.compatMode);

document.body.clientWidth ==> BODY对象宽度
document.body.clientHeight ==> BODY对象高度
document.documentElement.clientWidth ==> 可见区域宽度(Quirks Mode不兼容)
document.documentElement.clientHeight ==> 可见区域高度([b]Quirks Mode不兼容)[/b]

IE标准模式下 clientWidth 和 scrollWidth值相同;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: