1var x;
2var y;
3if (e.pageX || e.pageY) {
4 x = e.pageX;
5 y = e.pageY;
6}
7else {
8 x = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
9 y = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
10}
11x -= gCanvasElement.offsetLeft;
12y -= gCanvasElement.offsetTop;