Document.onmousemove=function (e) {
if (!document.all) {
Moux = (parseint (e.pagex) +3) + ' px ';
Mouy = (parseint (e.pagey) +6) + ' px ';
}else{
var appversions=window.navigator.appversion.split (';');
if (Appversions[1].replace (/[^/w]/, '). Replace (/[a-z/s]/img, ') = = ' 7.0 ') {
var obj= event.element (Event);/need to use PROTOTYE.J
Moux = obj.offsetleft+150;//may change according to your situation
Mouy = obj.offsettop+175;//may change according to your situation
}else{
Moux = Event.clientx + document.body.scrollleft+3;
Mouy = Event.clienty + document.body.scrolltop+21;
}
}
};
There is a more reliable method, but you need to pass in the event as an argument when the mouse incident occurs:
function mouseposition (EV) {
if (Ev.pagex | | ev.pagey) {
return {x:ev.pagex, y:ev.pagey};
}
return {
X:ev.clientx + Document.body.scrollleft-document.body.clientleft,
Y:ev.clienty + document.body.scrolltop-document.body.clienttop
};
}
function A (EV) {
var pos=mouseposition (EV);
alert (ev.x);
}
Use methods such as: <input onclick= "A (event)" type= "button" value= "Moupos" >;