I am posting the script because maybe in the future the file could be
delete and someone could have the same question:

var map;
var infowindowOpen = false;
if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map"));
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());
        map.setCenter(new GLatLng(37.4419, -122.1419), 12);
        map.getInfoWindow().show();
        var iw = map.getInfoWindow();

        GEvent.addListener(iw, "closeclick",
        function() {
                infowindowOpen = false;
        });

        //Note: this call to retrieve markers is required for Listing 3-8
        var latlng = new GLatLng(parseFloat('37.4356124041'), parseFloat
('-122.159729004'));
        var html = '<b>One</b> ';
        var marker = new GMarker(latlng);
        GEvent.addListener(marker, 'click',
        function() {
                var markerHTML = html;
                infowindowOpen = true;
                marker.openInfoWindowHtml(html, {
                        noCloseOnClick: true
                });
        });
        map.addOverlay(marker);

        //Note: this call to retrieve markers is required for Listing 3-8
        var latlng = new GLatLng(parseFloat('37.4184359437'), parseFloat
('-122.132606506'));
        var html2 = '<b>Two</b> ';
        var marker2 = new GMarker(latlng);
        GEvent.addListener(marker2, 'click',
        function() {
                var markerHTML = html2;
                infowindowOpen = true;
                marker2.openInfoWindowHtml(html2, {
                        noCloseOnClick: true
                });
        });
        map.addOverlay(marker2);

        /* [listing 3-4] */
        GEvent.addListener(map, "click",
        function(overlay, latlng) {
                //only perform the click if the window is closed and the click 
was
directly on the map.
                if (!overlay) {
                        //create an HTML DOM form element
                        var inputForm = document.createElement("div");
                        //retrieve the longitude and lattitude of the click 
point
                        var lng = latlng.lng();
                        var lat = latlng.lat();
                        inputForm.innerHTML = 'hola<br>' + latlng.toUrlValue(6);
                        if (!infowindowOpen) {
                                map.openInfoWindow(latlng, inputForm, {
                                        noCloseOnClick: true
                                });
                        }
                }
        });

}

// display a warning if the browser was not compatible
else {
        alert("Sorry, the Google Maps API is not compatible with this
browser");
}


Thanks again for

On Jun 9, 9:17 pm, "[email protected]" <[email protected]>
wrote:
> On Jun 9, 6:54 pm, Nicolas <[email protected]> wrote:
>
>
>
> > Hi Pil! I think you missed the link with the map that I posted in my
> > first comment, anyway, I am posting it again for you:
>
> > LINK: --------------http://flipxing.com/no_borrar.html
>
> > As you can see I have the noCloseOnClick:true
>
> > The problem is that I have a GEvent.addListener(map, "click", function
> > (overlay, latlng) that is watching the map, that is the reason the
> > marker's infowindow is closing down when I click the map.
>
> > What I want to do is: If I click a marker then an infowindow opens,
> > but I DO NOT want to to close it down when some one click on the map,
> > only when click the "x" icon (I really don't want the infowindow close
> > down). How can I do that?? what is the code?... I am a beginner and I
> > really don't know  how to code what are you saying.
>
> You mean something like this?
>
> http://www.geocodezip.com/no_borrarC.html
>
>   -- Larry
>
>
>
> > Thanks for your time
> > Nicolas
>
> > On Jun 9, 2:27 am, "Pil (Trustworthy from Experience)"
>
> > <[email protected]> wrote:
> > > On Jun 8, 11:59 pm, Nicolas <[email protected]> wrote:
>
> > > > Hi! thanks for your answer. I already tried with:
> > > > marker.openInfoWindowHtml(html, { noCloseOnClick:true });  but it
> > > > doesn't work,
>
> > > Then you made something wrong. Thats one reason why we would need a
> > > link to the non working map - as stated in the posting guidelines.
>
> > > Before opening an infowindow you can check if a *global* variable has
> > > the right value and then open it
>
> > > if(flag == true) open.infowindow...
>
> > > That would mean that the infowindow cannot be openend as long as the
> > > variable flag is set to false. So you have to switch the variable flag
> > > accordingly.- Hide quoted text -
>
> > - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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