S
SuNcO
Ok, i have a code that need to show a DIV on X and Y position. The next
code works fine :
<script language="JavaScript">
var IE = document.all?true:false;
if (!IE) { document.captureEvents(Event.MOUSEMOVE); }
document.onmousemove = getMouseXY;
var tempX = 0;
var tempY = 0;
function getMouseXY(e) {
if (IE) {
tempX = event.clientX + document.body.scrollLeft;
tempY = event.clientY + document.body.scrollTop;
} else {
tempX = e.pageX;
tempY = e.pageY;
}
if (tempX < 0){ tempX = 0; }
if (tempY < 0){ tempY = 0; }
document.Formulario.MouseX.value = tempX;
document.Formulario.MouseY.value = tempY;
}
</script>
The position is put on a Form (to test). Ok, the problem now is that
when i do the same thing with a window.open then not work. If i move
the scrollbars the ScrollTop is always to 0 then tempY is wrong
I open the window with this :
window.open('file.php','whatever','width=790,height=530,scrollbars=yes,
dependent=yes');
code works fine :
<script language="JavaScript">
var IE = document.all?true:false;
if (!IE) { document.captureEvents(Event.MOUSEMOVE); }
document.onmousemove = getMouseXY;
var tempX = 0;
var tempY = 0;
function getMouseXY(e) {
if (IE) {
tempX = event.clientX + document.body.scrollLeft;
tempY = event.clientY + document.body.scrollTop;
} else {
tempX = e.pageX;
tempY = e.pageY;
}
if (tempX < 0){ tempX = 0; }
if (tempY < 0){ tempY = 0; }
document.Formulario.MouseX.value = tempX;
document.Formulario.MouseY.value = tempY;
}
</script>
The position is put on a Form (to test). Ok, the problem now is that
when i do the same thing with a window.open then not work. If i move
the scrollbars the ScrollTop is always to 0 then tempY is wrong
I open the window with this :
window.open('file.php','whatever','width=790,height=530,scrollbars=yes,
dependent=yes');