Solved!

Because I need only one marker per time, I have a global variable
called currentMarker and a function createMarker.

        function vai(){
                // prendo il valore dell'opzione che contiene la stringa 
"lat|lng"
lo splitto e
                // converto i valori in float per creare un oggetto GLatLng da
passare a map.setCenter.
                
coord=(combodati.options[combodati.selectedIndex].value).split("|");
                centro = new GLatLng(parseFloat(coord[0]), 
parseFloat(coord[1]));
                // creo il marker
                if (currentmarker != null) {
                        if (map.getExtInfoWindow() != null) {
                        map.closeExtInfoWindow() ;
                        }
                        map.removeOverlay(currentmarker);
                        currentmarker = null;  //<======== added

                        }
                currentmarker = createMarker(centro,combodati.options
[combodati.selectedIndex].text) ;
                map.addOverlay(currentmarker);
                map.setCenter(centro);   //<======= placed after instead of 
before
addOverlay
        }

        // funzione per creare un marker, con relativo listner per il click
ed il mouseover
        function createMarker(point,text) {
        var marker = new GMarker(point, DSAico);
        GEvent.addListener(marker,"click", function() {
                GDownloadUrl("../dati/wikipage.php?titolo=" + text, function
(doc) {
                                  marker.openExtInfoWindow(map, "usnbWindow", 
doc,
{beakOffset: 10, paddingY: 15, paddingX: 15}
                                                        );
                        }
                );
        });
        map.addOverlay(marker);
        return marker;
        }

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-maps-api?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to