Chamilo is a learning management system focused on ease of use and accessibility
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
chamilo-lms/sincro/mapagoogle.html

53 lines
1.9 KiB

<html>
<head>
<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=AIzaSyCxElj7e8OT-90nnhNPZk6dSyBXf5T3q-s"
type="text/javascript"></script>
<script src="jquery-1.8.3.min.js" type="text/javascript" ></script>
<script type="text/javascript">
var map = null;
var geocoder = null;
$(window).load(function () {
if (GBrowserIsCompatible()) { // Abre LLAVE 2.
map = new GMap2(document.getElementById("map"));
map.setCenter(new GLatLng(-10.9755,-74.9757), 6);
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
geocoder = new GClientGeocoder();
//---------------------------------//
// MARCADOR AL HACER CLICK
GEvent.addListener(map, "click",
function(marker, point) {
if (marker) {
null;
} else {
map.clearOverlays();
var marcador = new GMarker(point);
map.addOverlay(marcador);
var latitude=document.getElementById("latitud");
var longitude=document.getElementById("longitud");
while(latitude.firstChild) {
latitude.removeChild(latitude.firstChild);
}
latitude.appendChild(document.createTextNode(point.y));
while(longitude.firstChild) {
longitude.removeChild(longitude.firstChild);
}
longitude.appendChild(document.createTextNode(point.x));
}
}
);
//---------------------------------//
// FIN MARCADOR AL HACER CLICK
//---------------------------------//
} // Cierra LLAVE 1.
});
</script>
</head>
<body >
<div style="width: 350px; border-width: 1px; border-style: solid; border-color: #979797; padding:8px 8px 8px 8px;">
<div id="map" style="width: 350px; height: 350px"></div></div>
<div>Latitud:<span id="latitud"></span> </div>
<div>Longitud:<span id="longitud"></span> </div>
</body>
</html>