Get lattitude and longitude onmouseover and onclick event in google map

As you move the mouse over the google map you can see the lattitude and longitude displayed below the google map.
When you click on google map the lattitude and longitude of the mouse position is displayed in the text box below the google map.
This example is very simple so you can just view the source code to copy and use it. anyway i have explained below.

Lat Lng:
Lat Lng on click:

Code and Explanation

You can also copy this code by viewing the source code of this page
if (GBrowserIsCompatible())
	map = new GMap2(document.getElementById("mapa"));
	map.addControl(new GLargeMapControl());
	map.addControl(new GMapTypeControl(3));
	map.setCenter( new GLatLng(26.12295, -80.17122), 11,0);

		document.getElementById('latspan').innerHTML =
		document.getElementById('lngspan').innerHTML = point.lng()	
		document.getElementById('latlong').innerHTML = + ', ' + point.lng() 

		document.getElementById('latlongclicked').value = + ', ' + point.lng()
That is all folks. Enjoy.

By -

Comments, Suggestions, Objections, ...