i want to display lattitude and longitude a location that user click on the map wherever them wants (im not using marker event). but it still want shows. here is my code
var myCenter=new google.maps.LatLng(51.508742,-0.120850);
function initialize()
{
var mapProp = {
center:myCenter,
zoom:5,
mapTypeId:google.maps.MapTypeId.ROADMAP
};
var map=new google.maps.Map(document.getElementById("googleMap"),mapProp);
var marker=new google.maps.Marker({
position:myCenter,
});
marker.setMap(map);
var infowindow = new google.maps.InfoWindow();
google.maps.event.addListener(map, 'click', function(event)
{
infowindow.setContent(event.LatLng.lat()+","+event.latlng.lng());
infowindow.open(map,marker);
});
}
google.maps.event.addDomListener(window, 'load', initialize);
anybody can help?? thanks..
Aucun commentaire:
Enregistrer un commentaire