Ver Mensaje Individual
  #2 (permalink)  
Antiguo 20/04/2012, 15:27
Avatar de Panino5001
Panino5001
Me alejo de Omelas
 
Fecha de Ingreso: mayo-2004
Ubicación: -34.637167,-58.462984
Mensajes: 5.148
Antigüedad: 20 años
Puntos: 834
Respuesta: Coordenadas de marcadores "arrastrables"

Probá y leé: https://developers.google.com/maps/d...ascript/events
Código PHP:
<!DOCTYPE html>
<
html>
<
head>
<
meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<
style type="text/css">
  
html height100% }
  
body height100%; margin0pxpadding0px }
  
#map_canvas { height: 100% }
</style>
<
script type="text/javascript"
    
src="https://maps.google.com/maps/api/js?sensor=false">
</script>
<script type="text/javascript">
function getCoords(marker){
    document.getElementById("loglat").innerHTML='Latitud: '+marker.getPosition().lat();
      document.getElementById("loglong").innerHTML='Longitud: '+marker.getPosition().lng();
}
function initialize() {
    var myLatlng = new google.maps.LatLng(20.990291,-89.613590);
    var myOptions = {
        zoom: 16,
        center: myLatlng,
        mapTypeId: google.maps.MapTypeId.ROADMAP,
    }
    var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
    
   marker = new google.maps.Marker({
          position: myLatlng,
          draggable: true,
          title:"Hello World!"
    });
    google.maps.event.addListener(marker, "dragend", function() {
                    getCoords(marker);
    });
    
      marker.setMap(map);
    getCoords(marker);
    
  
  }

</script>
</head>
<body onload="initialize()">
  
<div id="map_canvas" style="width:400px; height:400px"></div><br>
<font color="#0000FF"><strong id="loglat">Latitud:</strong></font> 

<br>
<font color="#FF0000"><strong id="loglong">Longitud:</strong></font> 

</body>
</html>