IE8事件坐标 [英] IE8 event coordinates
本文介绍了IE8事件坐标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我似乎找不到在IE8中获取事件坐标的方法,它只会触发诸如 pageX undefined, clientX undefined等错误。虽然在其他浏览器中效果很好。
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?
推荐答案
以下似乎有效。我不确定这样做是否正确:
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;
这篇关于IE8事件坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文