25 Novembre 2024 17:40:59
Notizie: lo sai che puoi installare Firefox anche su dispositivi Apple iPhone e iPad? Provalo subito!
0 Utenti e 1 Visitatore stanno visualizzando questo topic.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Documento senza titolo</title><script type="text/javascript" src="mootools-core-1.3.1-full-compat-yc.js"></script><script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script><script type="text/javascript"> var geocoder; var error;window.addEvent("domready", function(){ geocoder = new google.maps.Geocoder();});//chiude AddEvent function codeLatLng(position) { if (navigator.geolocation) { try{ navigator.geolocation.getCurrentPosition( function (position) { GeocodeReverse(position); }, // next function is the error callback function (error) { switch(error.code) { case error.TIMEOUT: alert ('Timeout'); break; case error.POSITION_UNAVAILABLE: alert ('Position unavailable'); break; case error.PERMISSION_DENIED: alert ('Permission denied'); break; case error.UNKNOWN_ERROR: alert ('Unknown error'); break; } } );//chiude geolocation.getCurrentPosition }//chiude try su geolocation.getCurrentPosition catch(error) { //alert(JSON.encode(e)); } }//chiude if navigator.geolocation }function GeocodeReverse(position){ var lat = position.coords.latitude; var lng = position.coords.longitude; var latlng = new google.maps.LatLng(lat, lng); geocoder.geocode({'latLng': latlng}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { if (results[1]) { alert(results[1].formatted_address); } else { alert("No results found"); } } else { alert("Geocoder failed due to: " + status); } }); }</script></head><body><div> <input type="button" value="Reverse Geocode" onclick="codeLatLng()"></div></body></html>