[removed] IE8 event coordinates

2019-06-23 19:37发布

I can't seem to find a way to get coordinates of event in IE8, it just triggers errors like... pageX undefined, clientX undefined etc. While it works find in other browsers.

This is what I was trying to do:

document.onmousemove=setcoord;

function setcoord(e){
    var xxcoord = e.pageX||(e.clientX+document.body.scrollLeft);
    var yycoord = e.pageY||(e.clientY+document.body.scrollTop);
}

Is there any workaround to get that mouse position ?..

1条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-06-23 20:20

The following seems to work. I'm not sure its is the proper way to do this:

var x=event.clientX;
var y=event.clientY;
查看更多
登录 后发表回答