So che non è il forum asp ma penso che la discussione competa più javascript che il linguaggio server:
Ho una pagina mappa-google.html che mi fa vedere la mappa di google e calcola il percorso partendo da un punto prefissato solo che se rinomino il file in .asp non funziona
La cosa mi sembra alquanto strana
codice:
<body onload="initialize()" onunload="GUnload()">
<script src=" http://maps.google.it/?file=api&v=2....ePaB90MRgoM6GA" type="text/javascript"></script>
<script type="text/javascript">
var map;
var gdir;
var geocoder = null;
var addressMarker;
function initialize() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map_canvas"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(47.856101,12.290016), 16);
var marker = new GMarker(new GLatLng(47.856101,12.290016))
map.addOverlay(marker);
marker.openInfoWindowHtml("punto-mappa");
gdir = new GDirections(map, document.getElementById("directions"));
GEvent.addListener(gdir, "error", handleErrors);
}
}
function setDirections(fromAddress) {
locale="it";
gdir.load("from: " + fromAddress + " to: via roma, 3 napoli");
}
function handleErrors(){
if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
alert("Indirizzo non trovato");
else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)
alert("Si è verificato un errore nella geocodifica degli indirizzi");
else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)
alert("Manca un parametro");
else if (gdir.getStatus().code == G_GEO_BAD_KEY)
alert("Errore nella Key Api.");
else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)
alert("La richiesta non puo' essere correttamente risolta.");
else alert("Si è verificato un errore");
}
</script>
<div id="map_canvas" style="width: 600px; height: 350px">
</div>
<div id="location">
<form action="#" onsubmit="setDirections(this.partenza.value); return false">
<h2>Calcola il percorso:</h2>
parti da: <input type="text" name="partenza"><input type="submit" value="Calcola">
</form>
</div>
<div id="directions" style="width: 420px"></div>
</body>