document.compatMode属性和获取鼠标的位置
document.compatMode属性
document.compatMode用来判断当前浏览器采用的渲染方式。
官方解释:
BackCompat:标准兼容模式关闭。
CSS1Compat:标准兼容模式开启。
当document.compatMode等于BackCompat时,浏览器客户区宽度是document.body.clientWidth;
当document.compatMode等于CSS1Compat时,浏览器客户区宽度是document.documentElement.clientWidth。
//获取鼠标的位置
getMousePoint = function (_e) {
var _body = document.body,
_left = ,
_top = ;
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;
};
document.compatMode属性和获取鼠标的位置的更多相关文章
- Range对象理解,浏览器兼容性,获取鼠标光标位置
一.关于浏览器的兼容性 目前主要有3种关于range的类似的对象,分别是W3C range 对象,Mozzlia selection ,ie TextRange 关于这三种的区别,请查看文档 http ...
- 获取鼠标经过位置的X、Y坐标
利用JavaScript获取鼠标经过位置的X.Y坐标方法. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN& ...
- js获取鼠标的位置
<!doctype html><html><head><meta charset="utf-8"><title>获取鼠标 ...
- WPF 获取鼠标屏幕位置、窗口位置、控件位置
原文:WPF 获取鼠标屏幕位置.窗口位置.控件位置 public struct POINT { public int X; public int Y; public POINT(int x, int ...
- js获取鼠标坐标位置兼容多个浏览器
这个是IE 11 下兼容下视图测试时可用. $(window).bind('beforeunload', function (event) { var _this = this; var x = ev ...
- document.compatMode属性
document.compatMode用来判断当前浏览器采用的渲染方式. 官方解释: BackCompat:标准兼容模式关闭.CSS1Compat:标准兼容模式开启. 当document.compat ...
- javascript document.compatMode属性
文档模式在开发中貌似很少用到,最常见的是就是在获取页面宽高的时候,比如文档宽高,可见区域宽高等. IE对盒模型的渲染在 Standards Mode和Quirks Mode是有很大差别的,在Stand ...
- WPF获取鼠标当前位置
/// <summary> /// 设置鼠标的坐标 /// </summary> /// <param name="x">横坐标</par ...
- HTML页面上获取鼠标的位置(备忘)
<html> <head> <meta http-equiv="Content-Type" content="text/html; char ...
随机推荐
- C#,.Net自动生成大写字母编码
public static string GetChineseSpell(string strText) { int len = strText.Length; ...
- 在VS2012/2013上编辑和调试Quick-cocos2d-x的Lua代码
类似教程链接:http://www.cocoachina.com/bbs/read.php?tid=205043 步骤: 一.Quick-cocos2d-x 最新版本或要打算使用的版本 (http:/ ...
- php课程---Windows.open()方法参数详解
Window.open()方法参数详解 1, 最基本的弹出窗口代码 window.open('page.html'); 2, 经过设置后的弹出窗口 window.open('page.html ...
- 使用eclipse开发servlet
package cn.itcast; import java.io.IOException; import javax.servlet.GenericServlet; import javax.ser ...
- Visual Studio中删除所有空行
解决方法如下: 使用快捷键Ctrl+H,显示查找和替换视图菜单 Find what(查找内容):^:b*$\n Replace with(替换为):[Empty] (空字符串,什么都不用填) Look ...
- 杂-lowbit
int lowbit(int x){ )); } int lowbit(int x){ return x&-x; }
- == 与 equals
参考:http://www.cnblogs.com/dolphin0520/p/3592500.html
- Android RecyclerView的基本使用
Android RecyclerView 在去年的Google I/O大会上就推出来了,以前经常使用的ListView 继承的是AbsListView,而RecyclerView则直接继承 ViewG ...
- AD6电气规则错误报告中英文对照
Ⅰ:Error Reporting 错误报告 A:Violations Associated with Buses 有关总线电气错误的各类型(共 12 项) ◆ bus indices out of ...
- .dmp文件导入个别表
imp bizinfo_qy/bizinfo_qy@orcl161 file=D:\收付费核算系统\分线\bizinfo_qy.dmp log=bizinfo_qy.log TABLES=(al_i ...