鼠標和滾輪事件
阿新 • • 發佈:2017-11-02
client click func eve event screen dha util 客戶
1、可以通過以下代碼取得鼠標事件的客戶端坐標信息;
var btn = document.getElementById("btn");
EventUtil.addHandler(btn,"click",function(event){
event = EventUtil.getEvent(event);
alert("client coordinates:" + event.clientX+","+event.clientY)
});
2、可以通過以下代碼取得鼠標事件的頁面坐標信息;
var btn = document.getElementById("btn");
EventUtil.addHandler(btn,"click",function(event){
event = EventUtil.getEvent(event);
alert("client coordinates:" + event.pageX+","+event.pageY)
});
3、可以通過以下代碼取得鼠標事件的屏幕坐標信息;
var btn = document.getElementById("btn");
EventUtil.addHandler(btn,"click",function(event){
event = EventUtil.getEvent(event);
alert("client coordinates:" + event.screenX+","+event.screenY)
});
鼠標和滾輪事件