[thelist] CSS
Niklaus Haldimann
nhaldimann at gmx.ch
Fri Nov 9 06:29:21 CST 2001
On 8 Nov 01, at 15:00, aardvark wrote:
> erm, just saw my name... was i in this thread?
erm, no. that was my fault. i think i mixed this thread up with a
different one where you mentioned @import. ;) might have been your
site check thread. or maybe i was just daydreaming. nevermind.
<tip>
ever wondered how to capture the position of the mouse on the screen
(resp. in the browser window) with javascript? this script works for
me in all major browsers:
<script type="text/javascript">
<!--
if (window.Event) document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = getMousePosition;
var mouseX, mouseY;
function getMousePosition(evt) {
if (document.all) {
mouseX = event.clientX + (document.body.scrollLeft ?
document.body.scrollLeft : 0);
mouseY = event.clientY + (document.body.scrollTop ?
document.body.scrollTop : 0);
}
else {
mouseX = evt.pageX;
mouseY = evt.pageY;
}
return false;
}
// -->
</script>
after this bit of code has run you can access the mouse position with
the variables mouseX and mouseY. this for example would show the
mouse position when you click on the link:
<a href="#" onClick="alert('mouse position:
'+mouseX+'/'+mouseY)">Click here</a>
</tip>
More information about the thelist
mailing list