[event.target]event.X和event.clientX属性参考分析

更新时间:2017-04-15    来源:窗口特效    手机版     字体:

【www.bbyears.com--窗口特效】

event.clientX返回事件发生时,mouse相对于客户窗口的X坐标
event.X也一样
但是如果设置事件对象的定位属性值为relative
event.clientX不变
而event.X返回事件对象的相对于本体的坐标
event对象详解 ICOOE 2000.3.31 http://www.111cn.net
event代表事件的状态,例如事件发生的的元素、鼠标的位置等等,event对象只在事件过程中才有效。

event属性:

altKey
检索ALT键的当前状态
可能的值 true为关闭
false为不关闭

button
检索按下的鼠标键
可能的值: 0 没按键
1 按左键
2 按右键
3 按左右键
4 按中间键
5 按左键和中间键
6 按右键和中间键
7 按所有的键

cancelBubble
设置或检索当前事件是否将事件句柄起泡
可能的值: false 启用起泡
true 取消该事件起泡

clientX
检索与窗口客户区域有关的鼠标光标的X坐标,属性为只读,没有默认值。

clientY
检索与窗口客户区域有关的鼠标光标的Y坐标,属性为只读,没有默认值。

ctrlKey
ctrlKey 检索CTRL键的当前状态
可能的值 true为关闭
false为不关闭

 代码如下




Click here to show. 



<script>
function show(){
alert("window.event.x:"+window.event.x+"nwindow.event.y:"+window.event.y+"nevent.clientX:"+event.clientX+"nevent.clientY:"+event.clientY+"nevent.offsetX:"+event.offsetX+"nevent.offsetY:"+event.offsetY+"nwindow.event.screenX:"+window.event.screenX+"nwindow.event.screenY:"+window.event.screenY);
}
</script>

本文来源:http://www.bbyears.com/wangyetexiao/31932.html

热门标签

更多>>

本类排行