1function mousePosX(e) { 2 var posx = 0; 3 if (!e) var e = window.event; 4 if (e.pageX) { 5 posx = e.pageX; 6 } 7 else if (e.clientX) { 8 posx = e.clientX + document.body.scrollLeft 9 + document.documentElement.scrollLeft; 10 } 11 return posx; 12} 13 14function mousePosY(e) { 15 var posy = 0; 16 if (!e) var e = window.event; 17 if (e.pageY) { 18 posy = e.pageY; 19 } 20 else if (e.clientY) { 21 posy = e.clientY + document.body.scrollTop 22 + document.documentElement.scrollTop; 23 } 24 return posy; 25} 26