<script src="https://www.google.com/jsapi?votre cle google api" type="text/javascript"></script>
<script type="text/javascript"src="http://maps.google.com/maps/api/js?sensor=true">
</script>
<script type="text/javascript">
function initialize() {
var adr2 ="";
var lat=google.loader.ClientLocation.latitude;
var longi=google.loader.ClientLocation.longitude;
var latlng = new google.maps.LatLng(lat, longi);
var geocoder = new google.maps.Geocoder();
geocoder.geocode({'latLng': latlng}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
if (results[0]) {
var elt = results[0].address_components;
for(i in elt){
if(elt[i].types[0] == 'postal_code')
gmap_cp=elt[i].long_name;
if(elt[i].types[0] == 'locality')
gmap_ville=elt[i].long_name;
if(elt[i].types[0] == 'administrative_area_level_1')
gmap_region=elt[i].long_name;
if(elt[i].types[0] == 'administrative_area_level_2')
gmap_departement=elt[i].long_name;
if(elt[i].types[0] == 'country')
gmap_pays=elt[i].long_name;
}
adr2 += "ta ville : " + gmap_ville +"<br>";
adr2 += "ton code postal : " + gmap_cp +"<br>";
adr2 += "ton département : " + gmap_departement +"<br>";
adr2 += "ta région : " + gmap_region +"<br>";
adr2 += "ton pays : " + gmap_pays +"<br>";
document.getElementById("test_gloader_gmap").innerHTML = adr2;
}
}
});
}
</script>
</head>
<body onLoad="initialize()">
<div id="test_gloader_gmap" >teoo..</div>
</body>