...

View Full Version : How to use event.ClientX and Y



shlagish
10-11-2003, 03:03 AM
Hello,

here is the code I come up with.



<html>
<head>
<script type="text/javascript">
<!--

var posX;
var posY;

function position()
{

posX=event.ClientX;
posY=event.ClientY;
alert(posX);
alert(posY);

}


-->
</script>
</head>
<body onMouseMove="position()">
</body>
</html>

I did try to do this:


<html>
<head>
<script type="text/javascript">
<!--

function position()
{

alert(event.ClientX);
alert(event.ClientY);

}


-->
</script>
</head>
<body onMouseMove="position()">
</body>
</html>

but there was the same result:
The alert boxes say "undifined" instead of revealing the X and Y position of the cursor.
Why is this not working?

Thanks

fredmv
10-11-2003, 03:08 AM
It's client, not Client. You need to remember, JavaScript is case sensitive. :D

shlagish
10-11-2003, 03:10 AM
OMG, I can't beleive THAT'S my mistake!!!

Thank you very much!

fredmv
10-11-2003, 03:18 AM
No problem! It's a very common mistake. :D



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum