Sto cercando di far mostrare 2 marker diversi e li pesco dalla directory "fig"
Sono 2 pezzi di codice copiati, ho solo cambiato un valore aggiungendo il numeero 2, solo che mi mostra un'icona che dico io e cioe' la seconda icona che sarebbe /fig/marker_blu.gif mentre la prima che sarebbe /fig/marker.gif non me la mostra piu' ma mette quella di default.
Se tolgo il secondo pezzo di codice riesco a vedere bene il marker che dico io.
Cmq questo e' il codice:
codice:
<script type="text/javascript">
var map = null;
var geocoder = null;
var icon = icon;
function load() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(40.727486,13.907318), 13);
icon = new GIcon();
icon.image = "fig/marker.png";
icon.iconSize = new GSize(23, 34);
icon.iconAnchor = new GPoint(6, 20);
icon.infoWindowAnchor = new GPoint(5, 1);
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, icon);
map.addOverlay(marker);
}
}
);
}
}
</script>
<script type="text/javascript">
function load(address) {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(40.727486,13.907318), 13);
icon2 = new GIcon();
icon2.image = "fig/marker-blu.png";
icon2.iconSize = new GSize(23, 34);
icon2.iconAnchor = new GPoint(6, 20);
icon2.infoWindowAnchor = new GPoint(5, 1);
geocoder = new GClientGeocoder();
}
}
function showAddress2(address) {
if (geocoder) {
geocoder.getLatLng(
address,
function(point) {
if (!point) {
alert(address + " not found");
} else {
map.setCenter(point, 13);
var marker = new GMarker(point, icon2);
map.addOverlay(marker);
}
}
);
}
}
</script>
come mai non esce il marker indicato nel primo pezzo di codice ma esce quello di default?