G
Guest
How can I get the mouse coordinates in Mozilla?
I try
x = event.pageX
but it does not work...
basically I try
alert(event) and it does not work.
Where is the problem?
the full code
------------------------
<script>
var obj = document.getElementById('tooltip');
if (navigator.appName == "Microsoft Internet Explorer") isIE = true; else
isIE = false;
function handlerMM(e){
if (isIE) { x = event.pageX; y = event.pageY; }
else {
alert(event);
x = event.clientX + document.body.scrollLeft;
y = event.clientY + document.body.scrollTop;
}
obj.style.top = y + 10;
obj.style.left = x + 15;
}
</script>
I try
x = event.pageX
but it does not work...
basically I try
alert(event) and it does not work.
Where is the problem?
the full code
------------------------
<script>
var obj = document.getElementById('tooltip');
if (navigator.appName == "Microsoft Internet Explorer") isIE = true; else
isIE = false;
function handlerMM(e){
if (isIE) { x = event.pageX; y = event.pageY; }
else {
alert(event);
x = event.clientX + document.body.scrollLeft;
y = event.clientY + document.body.scrollTop;
}
obj.style.top = y + 10;
obj.style.left = x + 15;
}
</script>