[Javascript] getting mouse coords
Christophe Lancian
clancian at capgemini.fr
Wed May 16 11:32:45 CDT 2001
Hi Chris,
I think I nearly get want you want mouse coords will appear in the status bar :
<head>
<script language="JavaScript">
ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false
function init()
{
if (ns4)
{
document.captureEvents(Event.MOUSEMOVE);
}
document.onmousemove=mousemove;
}
function mousemove(e)
{
if (ns4)
{
var mouseX=e.pageX; var mouseY=e.pageY}
if (ie4)
{
var mouseX=event.x; var mouseY=event.y
}
status="x= "+mouseX+", y= "+mouseY;
}
</script>
</head>
<body onLoad="init()">
....
</body>
Krgds,
_ ___
_ _ .-' ' -.
(.)(.)/ \
/00 ;
o_\\-mm-..........-mm`~~~~~~~~~~~~~~
Christophe Lancian - CAP GEMINI
Service Line Accelerated Delivery Services
clancian at capgemini.fr
~~~~~~~~~~~~~~~~~~~~~~~~~~~
----- Original Message -----
From: "Chris Basken" <chriz at basken.com>
To: "Javascript Gurus" <javascript at LaTech.edu>
Sent: Wednesday, May 16, 2001 6:05 PM
Subject: [Javascript] getting mouse coords
> anyone know of a quick way to retrieve the cursor coodinates on a page?
> something like onClick="alert(evt.pageX)"..?
>
> thanks...
>
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> http://www.LaTech.edu/mailman/listinfo/javascript
More information about the Javascript
mailing list