clientX, clientY,offsetX, offsetY,screenX, screenY, x, y
clientX, clientY是鼠标当前相对于网页的位置,当鼠标位于页面左上角时clientX=0, clientY=0;
offsetX, offsetY是鼠标当前相对于网页中的某一区域的位置,当鼠标位于页面中这一区域的左上角时offsetX=0, offsetY=0;
screenX, screenY是相对于用户显示器的位置
x,y是鼠标相对于当前浏览器的位置
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD><TITLE>Measure for Measure</TITLE>
<SCRIPT>
<!--
function one() {
report.value = "The DIV above is relatively positioned in the BODY. The style object contains the information that was set in the inline style to position this object. The following are the values that would be reported for the various position and dimension properties on the style object for the DIV:" + "\n\n";
report.value= report.value + " mydiv.style.top (string) = " + foodiv.style.top + "\n";
report.value= report.value + " mydiv.style.left (string) = " + foodiv.style.left + "\n";
report.value= report.value + " mydiv.style.height (string) = " + foodiv.style.height + "\n";
report.value= report.value + " mydiv.style.width (string) = " + foodiv.style.width + "\n";
report.value= report.value + " mydiv.style.pixelTop (long) = " + foodiv.style.pixelTop + "\n";
report.value= report.value + " mydiv.style.pixelLeft (long) = " + foodiv.style.pixelLeft + "\n";
report.value= report.value + " mydiv.style.pixelHeight (long) = " + foodiv.style.pixelHeight + "\n";
report.value= report.value + " mydiv.style.pixelWidth (long) = " + foodiv.style.pixelWidth + "\n";
report.value= report.value + " mydiv.style.posTop (long) = " + foodiv.style.posTop + "\n";
report.value= report.value + " mydiv.style.posLeft (long) = " + foodiv.style.posLeft + "\n";
report.value= report.value + " mydiv.style.posHeight (long) = " + foodiv.style.posHeight + "\n";
report.value= report.value + " mydiv.style.posWidth (long) = " + foodiv.style.posWidth + "\n";
}
function two() {
report.value = "Each object has a set of offset positions. The offset properties for the positioned darkBlue DIV above are: \n";
report.value= report.value + " offsetLeft = " + foodiv.offsetLeft + "\n";
report.value= report.value + " offsetTop = " + foodiv.offsetTop + "\n";
report.value= report.value + " offsetHeight = " + foodiv.offsetHeight + "\n";
report.value= report.value + " offsetWidth = " + foodiv.offsetWidth + "\n";
report.value= report.value + " offsetLeft = " + document.body.offsetLeft + "\n";
report.value= report.value + " offsetTop = " + document.body.offsetTop + "\n";
report.value= report.value + " offsetHeight = " + document.body.offsetHeight + "\n";
report.value= report.value + " offsetWidth = " + document.body.offsetWidth + "\n";
}
function three() {
report.value = "Scroll values for the darkBlue DIV object" + "\n";
report.value= report
clientX, clientY,offsetX, offsetY,screenX, screenY, x, y的更多相关文章
- 如何更好的理解(pageX,pageY,clientX,clientY,eventX,eventY,scrollX,scrollY,screenX,screenY,event.offsetX,event.offsetY,offsetLeft,style.left)
1 pageX,pageY:鼠标指针相对于当前窗口的X,Y坐标,计算区域包括窗口自身的控件和滚动条.(火狐特有) 2 event.clientX,event.clientY:鼠标指针相对于当前窗口的X ...
- JS之clientX,clientY,screenX,screenY,offsetX,offsetY区别
首先需要知道clientX,clientY,screenX,screenY,offsetX,offsetY 是鼠标事件对象下的几个属性. 之前也一直对这些属性搞的稀里糊涂,看文档上说的也是不太理解,反 ...
- 元素位置pageX,pageY,clientX,clientY,scrollX,scrollY,screenX,screenY,offsetX,offsetY
总结: event.clientX 设置或获取鼠标指针位置相对于当前窗口的 x 坐标,其中客户区域不包括窗口自身的控件和滚动条. (可见区域)event.clientY 设置或获取鼠标指针位置相对于当 ...
- JavaScript 中事件对象参数:clientX、clientY、offsetX、offsetY、screenX、screenY
JavaScript 中一些概念理解 :clientX.clientY.offsetX.offsetY.screenX.screenY clientX 设置或获取鼠标指针位置相对于窗口客户区域的 x ...
- pageX,clientX,screenX,offsetX的区别
pageX/pageY: 鼠标相对于整个页面的X/Y坐标,但IE不支持.以body元素为参考点. clientX/clientY: 鼠标在浏览器内容区域的X/Y坐标,不包含滚动条,即需要滚动条的地方不 ...
- 【clientX,offsetX,screenX】 【scrollWidth,clientWidth,offsetWidth】的区别
一.深刻认识clientX,offsetX,screenX 概念(来源于网络): clientX 设置或获取鼠标指针位置相对于当前窗口的 x 坐标,其中客户区域不包括窗口自身的控件和滚动条. clie ...
- pageX/pageY,screenX/screenY,clientX/clientY的差别
pageX/pageY,screenX/screenY,clientX/clientY的差别 $(document).click(function(e){ //x方向无差别 //alert(e.pag ...
- javascript坐标:event.x、event.clientX、event.offsetX、event.screenX 用法
clientX 设置或获取鼠标指针位置相对于窗口客户区域的 x 坐标,其中客户区域不包括窗口自身的控件和滚动条. clientY 设置或获取鼠标指针位置相对于窗口客户区域的 y 坐标,其中客户区域不包 ...
- clientX、pageX、offsetX、screenX的区别
这几个属性的区别说难不难,可是很容易搞混,很长一段时间没用,发现又忘记区别了,记不清哪个是哪个!真的很抓狂! 区别: clientX.clientY: 相对于浏览器窗口可视区域的X,Y坐标(窗口坐标) ...
随机推荐
- @PostContruct注解
@PostContruct是spring框架的注解,在方法上加该注解会在项目启动的时候执行该方法,也可以理解为在spring容器初始化的时候执行该方法.
- 去除Android APP里面的广告
如何去除Android游戏软件中的广告:很多时候,我们下载好一款Andriod游戏软件,却被游戏软件中的广告弄的很烦.不停跳动的广告让人觉得非常不爽,而且在玩游戏的时候,还有可能点击到广告,中断游戏. ...
- java 内部类和向上转型
当将内部类向上转型为其基类时,尤其是转型为一个接口的时候,内部类就有了用武之地,(从实现某个接口的对象,得到对接口的引用,与向上转型为这个对象的基类,实际上是一样的效果,),这是因为此内部类---某个 ...
- visual studio code插件精选
HTML Snippets 超级实用且初级的 H5代码片段以及提示 HTML CSS Support 让 html 标签上写class 智能提示当前项目所支持的样式 JavaScript Atom G ...
- 执行了‘“npm install mysql"
http是核心模块,封装到安装包里面了,如果在你项目的当前目录下<code>npm install mysql<code>的话就会在你当前目录下的node_modules文件夹 ...
- django用户系统的测试,蛮不错的。
https://blog.csdn.net/orangleliu/article/details/51944758 这个很实用 https://www.cnblogs.com/yanhuidj/p/1 ...
- StringUtils一些常用方法
StringUtils是org.apache.commons.lang jar包里面的类方法,当输入参数String为null则不会抛出NullPointerException,而是做了相应处理,nu ...
- mavean项目的jar位置的影响
由于项目的数据库需求改变了,有mysql数据库变为oracle的,那么对于项目就是需要改变数据库连接池.这个项目运用了mavean框架,那么下载jar在pom.xml文件中填写就可以了,但是oracl ...
- Redux 和 ngrx 创建更佳的 Angular 2
Redux 和 ngrx 创建更佳的 Angular 2 翻译:使用 Redux 和 ngrx 创建更佳的 Angular 2 原文地址:http://onehungrymind.com/build- ...
- react 15
react 15 最近项目由react0.14.X升级到react 15版本,因为react15还是做了一些相对大一点的更新的(详情可以参考一下我的另一篇文章关于react15的一点总结),相对:来说 ...