admin管理员组文章数量:1318988
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 fine 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?
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 fine 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?
Share Improve this question edited May 27, 2020 at 11:10 Brian Tompsett - 汤莱恩 5,89372 gold badges61 silver badges133 bronze badges asked Jun 14, 2012 at 22:34 AnonymousAnonymous 4,63010 gold badges66 silver badges97 bronze badges1 Answer
Reset to default 7The following seems to work. I'm not sure its is the proper way to do this:
var x=event.clientX;
var y=event.clientY;
本文标签: javascriptIE8 event coordinatesStack Overflow
版权声明:本文标题:javascript - IE8 event coordinates - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742055404a2418261.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论