Eccola, tieni però presente che lo script che vedi all'inizio contiene una API Key (Google Maps) valida solo se la utilizzi nell'ambito di un certo URL, dunque non credo riuscirai a farlo girare in locale presso la tua macchina, a meno che non ti crei una API Key da utilizzare in locale (trovi infos a questo thread: http://forum.html.it/forum/showthrea...readid=1167596 ) ... fammi sapere!
codice:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!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=iso-8859-1" />
<title>Google Maps API Example - Geocoding API</title>
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAqZ0bYiJxwuoqRp1FGmdqVBRa53uNMkvarnceuSWU8ARvjE4yfBQLVbfuWm59kX01DR-3z-XbSqhIHA" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
var map = null;
var geocoder = null;
function load() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map"));
/*mappa - satellite - ibrida */
map.addControl(new GMapTypeControl());
/*controller con barra vert*/
map.addControl(new GLargeMapControl());
/*zoom box, in basso a dx*/
map.addControl(new GOverviewMapControl(),
new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(9, 9)));
/*COORDINATE DI PARTENZA DELLA MAPPA*/
map.setCenter(new GLatLng(40.849, 14.247), 16);
geocoder = new GClientGeocoder();
// ho aggiunto questo
GEvent.addListener(map, "moveend", function() {
var center = map.getCenter();
var lat = center.lat().toFixed(6);
var lng = center.lng().toFixed(6);
document.getElementById("message1").innerHTML = lat;
document.getElementById("message2").innerHTML = lng;
document.getElementById("message3").innerHTML = lat;
document.getElementById("message4").innerHTML = lng;
});
// fine aggiunta
}
}
/*cerca un indirizzo*/
function showAddress(address) {
if (geocoder) {
geocoder.getLatLng(
address,
function(point) {
if (!point) {
alert(address + " non trovato");
} else {
/*zoom*/
map.setCenter(point, 16);
var marker = new GMarker(point);
map.addOverlay(marker);
marker.openInfoWindowHtml(address);
}
}
);
}
}
//]]>
</script>
<script>
window.onload = function(){
document.getElementById("tasto2").disabled=true;
document.getElementById("tasto1").disabled=false;}
function attiva(){
document.getElementById("tasto1").disabled=true;
document.getElementById("tasto2").disabled=false;
}
</script>
</head>
<body onload="load()" onunload="GUnload()">
<!--<div id="message1"></div>
<div id="message2"></div>-->
<form action="#" onsubmit="showAddress(this.address.value); return false;">
<input type="hidden" size="60" name="address" value="Piazza del Duomo Milano" />
<textarea name="coord1" id="message1" cols="10" rows="1" style="visibility:hidden"></textarea>
<textarea name="coord2" id="message2" cols="10" rows="1" style="visibility:hidden"></textarea>
<input id="tasto1" type="submit" value="Genera mappa" />
</p>
</form>
<form name="form2" action="mappa2.asp" method="post">
<textarea name="coord1" id="message3" cols="10" rows="1" style="visibility:hidden"></textarea>
<textarea name="coord2" id="message4" cols="10" rows="1" style="visibility:hidden"></textarea>
<input id="tasto2" type="submit" value="Memorizza" />
</p>
</form>
<div id="map" style="width: 700px; height: 350px; visibility:hidden"></div>
</body>
</html>
In pratica, il form n.1 genera delle coordinate che, clonate all'interno del form n.2, mi vengono inviate (tramite quest'ultimo) ad una seconda pagina tramite request.form.
Fammi sapere se hai bisogno di altre infos... e ancora grazie per il tuo aiuto!
t.