Esta es la forma como yo lo hago con la version 3. Recomiendo que la usen ya que es la que Google está actualizando. Las otras ya no las actualiza.
Código HTML:
Ver original<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> *{ margin: 0; padding: 0; }
html, body, #map{
width: 100%;
height: 100%;
}
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&language=es"></script> <script type="text/javascript"> window.onload = function(){
var options = {
zoom: 8
, center: new google.maps.LatLng(18.470338, -66.123503)
, mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map"), options);
google.maps.event.addListener(map, "click", function(e){
alert(e.latLng);
});
};