Jump to content

How to make x change automatically everytime the mouse moves ? pls see below...


jd2007

Recommended Posts

<html>
<head>
<script type="text/javascript">
var z=0;
function show_coords(event)
{
x=event.clientX
y=event.clientY
document.write(x);
}
setInterval("show_coords(event)",50)
</script>
</head>

<body onmousemove="show_coords(event)";>
<script></script>
<p>Click in the document. An alert box will alert the x and y coordinates of the mouse pointer.</p>
<script>

</script>
</body>
</html>

 

now, x doesn't change automatically...i want x to change automatically everytime the mouse moves...what to do...pls help

never mind, i did it. i added back() in the show_coords(event) function....

 

<html>
<head>
<script type="text/javascript">
var z=0;
function show_coords(event)
{
x=event.clientX
y=event.clientY
document.write(x);
back()
}
setInterval("show_coords(event)",50)
</script>
</head>

<body onmousemove="show_coords(event)";>
<script></script>
<p>Click in the document. An alert box will alert the x and y coordinates of the mouse pointer.</p>
<script>

</script>
</body>
</html>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.