1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| function showAddress(address,comment) {
var map = new GMap2(document.getElementById("map_canvas"));
var geocoder = new GClientGeocoder();
map.addControl( new GLargeMapControl() );
geocoder.getLatLng(
address,
function(point) {
if (!point) {
alert(address + " Introuvable");
} else {
map.setCenter(point, 6);
var marker = new GMarker(point);
fillHiddenFields(point);
map.addOverlay(marker);
marker.bindInfoWindowHtml(comment);
}
}
);
}
function fillHiddenFields(point)
{
document.getElementById('latitude').value = point.y;
document.getElementById('longitude').value = point.x;
} |