[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 297
  • Last Modified:

How do I use asp.net (vb coding) to write the X Y mouse position coordinates to a server-side textfile?

I want to write the mouse position coordinates to a text file on the server as users move the cursor around. I would like to do this about 5-10 times per second via some type of appending-a-textfile method or perhaps store them in a hidden field (e.g. a hidden listbox etc) and then write them all at once to the server-side file. Anyone know how I can accomplish this? Many thanks.....

0
jazjef
Asked:
jazjef
  • 2
1 Solution
 
CoyotesITCommented:
This will capture the xy of the mouse onmove and will put the values in a textarea
<html>
 
<head>
 
<script language="javascript">
	function getXY()
	{
		var t = document.getElementById("mousexy");
		
		var x = window.event.clientX;
		var y = window.event.clientY;
		var xy = "X: " + x + ", Y: " + y + "\n";
		
		t.value = t.value + xy;
	}
</script>
 
</head>
 
<body onmousemove="getXY()">
 
<textarea id="mousexy" type="text" style="height:300px; width:400px;"></textarea>
 
</body>
 
</html>

Open in new window

0
 
jazjefAuthor Commented:
Brilliant.
0
 
CoyotesITCommented:
One note, use

pageX, pageY for Firefox.

if that is a concern.




0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now