document.compatMode属性和获取鼠标的位置
2016-08-12 17:13
429 查看
document.compatMode属性
document.compatMode用来判断当前浏览器采用的渲染方式。
官方解释:
BackCompat:标准兼容模式关闭。
CSS1Compat:标准兼容模式开启。
当document.compatMode等于BackCompat时,浏览器客户区宽度是document.body.clientWidth;
当document.compatMode等于CSS1Compat时,浏览器客户区宽度是document.documentElement.clientWidth。
document.compatMode用来判断当前浏览器采用的渲染方式。
官方解释:
BackCompat:标准兼容模式关闭。
CSS1Compat:标准兼容模式开启。
当document.compatMode等于BackCompat时,浏览器客户区宽度是document.body.clientWidth;
当document.compatMode等于CSS1Compat时,浏览器客户区宽度是document.documentElement.clientWidth。
//获取鼠标的位置 getMousePoint = function (_e) { var _body = document.body, _left = 0, _top = 0; if(typeof window.pageXOffset != 'undefined'){ _left = window.pageXOffset; _top = window.pageYOffset; } else if(typeof document.compatMode != 'undefined' && document.compatMode != 'BackCompat'){ _left = document.documentElement.scrollLeft; _top = document.documentElement.scrollTop; } else if(typeof _body != 'undefined'){ _left = _body.scrollLeft; _top = _body.scrollTop; } _left += _e.clientX; _top += _e.clientY; _mousepos.left = _left; _mousepos.top = _top; return _mousepos; };
相关文章推荐
- javascript document.compatMode属性
- document.compatMode属性
- document.compatMode属性
- 获取鼠标相对应document的位置
- document.compatMode属性
- document.compatMode属性
- document.compatMode属性
- javascript:与获取鼠标位置有关的属性
- document.compatMode 获取可视区宽高
- document.compatMode属性
- document.compatMode属性
- document.compatMode 获取可视区宽高
- document.compatMode属性
- JavaScript中获取鼠标位置相关属性总结
- 窗体、滚动条宽度和高度获取以及document.body和document.documentElement,document.compatMode解释(网页高度宽度)
- document.compatMode属性
- document.compatMode属性
- document.compatMode属性
- JavaScript中获取鼠标位置相关属性总结
- document.compatMode属性