jak poznać szerokość i szerokość geograficzną na kliknięciu mapy w Google Maps api v3. mam zrobić to w Google Maps API v2 z tym kodemjak uzyskać szerokość geograficzną, długość geograficzną onclick mapy w google maps api v3 javascript?
GEvent.addListener(map, "click", function(overlay, latlng) {
if (latlng) {
marker = new GMarker(latlng, {draggable:true});
GEvent.addListener(marker, "click", function() {
//alert("hello");
var html = "<table>" +
"<tr><td>Name:</td> <td><input type='text' id='name'/> </td> </tr>" +
"<tr><td>Time:</td> <td><input type='text' id='time'/> </td> </tr>" +
"<tr><td>Bus Id:</td> <td><input type='text' id='busId'/> </td> </tr>" +
"<tr><td>Device Id:</td> <td><input type='text' id='deviceId'/> </td> </tr>" +
"<tr><td></td><td><input type='button' value='Save & Close' onclick='saveData()'/></td></tr>";
marker.openInfoWindow(html);
});
map.addOverlay(marker);
}
});
jak zrobić to samo w v3?
Próbowałem, ale to nie zadziałało.
google.maps.event.addListener(map, "click", function(overlay,latlng) {
if (latlng) {
marker = new google.maps.Marker(latlng);
google.maps.event.addListener(marker, "click", function() {
var html = "<table>" +
"<tr><td>Name:</td> <td><input type='text' id='name'/> </td> </tr>" +
"<tr><td>Time:</td> <td><input type='text' id='time'/> </td> </tr>" +
"<tr><td>Bus Id:</td> <td><input type='text' id='busId'/> </td> </tr>" +
"<tr><td>Device Id:</td> <td><input type='text' id='deviceId'/> </td> </tr>" +
"<tr><td></td><td><input type='button' value='Save & Close' onclick='saveData()'/></td></tr>";
marker.openInfoWindow(html);
});
map.setMap(marker);
}
});
dziękuję diody ... –