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

Posted on 2008-11-03
Last Modified: 2012-05-05
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.....

Question by:jazjef
    LVL 8

    Accepted Solution

    This will capture the xy of the mouse onmove and will put the values in a textarea
    <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;
    <body onmousemove="getXY()">
    <textarea id="mousexy" type="text" style="height:300px; width:400px;"></textarea>

    Open in new window

    LVL 4

    Author Closing Comment

    LVL 8

    Expert Comment

    One note, use

    pageX, pageY for Firefox.

    if that is a concern.


    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    Suggested Solutions

    Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
    JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now