Web Analytics Made Easy -
StatCounter Storing values in array with left mouse click event - CodingForum

Announcement

Collapse
No announcement yet.

Storing values in array with left mouse click event

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Storing values in array with left mouse click event

    Hi all,

    I have a program where I will get Terrain coordinate values x and y in a pop up with left mouse click event hovering in a 3D window like google earth. I want to store those values in an array. I need help please. Any ideas about writing code.

    Thanking you all in advance,
    Sharat.

  • #2
    Here ya go:
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Test</title>
    <script type="text/javascript">
    // <![CDATA[
    
    function addMouseCoordinatesToArray(e)
    	{
    	e = e || window.event;
    	if (typeof(recorded_clicks) == "undefined") recorded_clicks = new Array();
    	recorded_clicks.push([e.clientX,e.clientY]);
    	displayRC();
    	}
    
    function displayRC()
    	{
    	var output = "[ [";
    	output += recorded_clicks.join("], [");
    	output += "] ]";
    	document.getElementsByTagName("body")[0].innerHTML = output;
    	}
    
    window.onload = function()
    	{
    	document.onclick = addMouseCoordinatesToArray;
    	}
    
    // ]]>
    </script>
    </head>
    <body>
    
    </body>
    </html>
    Feel free to e-mail me if I forget to respond ;)
    [email protected]

    Comment

    Working...
    X