Salve amici,
sto cercando di adattare uno script di googles maps per prendere in automatico un indirizzo:
<script type="text/javascript">
//<![CDATA[
var map = null;
var geocoder = null;
function load() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map"));
map.setCenter(new GLatLng(37.4419, -122.1419), 13);
geocoder = new GClientGeocoder();
}
}
function showAddress(address) {
if (geocoder) {
geocoder.getLatLng(
address,
function(point) {
if (!point) {
alert(address + " not found");
} else {
map.setCenter(point, 13);
var marker = new GMarker(point);
map.addOverlay(marker);
marker.openInfoWindowHtml(address);
}
}
);
}
}
//]]>
</script>
questo è il codice javascript, che prende il valore da:
<body onload="load()" onunload="GUnload()">
<form action="#" onsubmit="showAddress(this.address.value); return false">
<input type="text" size="60" name="address" value="1600 Amphitheatre Pky, Mountain View, CA" />
<input type="submit" value="Go!" />
</p>
<div id="map" style="width: 500px; height: 300px"></div>
</form>
</body>
Io però vorrei prendere il valore al caricamento della pagina da un database...
come posso modificarlo?