Ok,

I have it in my function now, but it doesnt work. What could be wrong?


function ShowMarkers(sDataArray, zoom) {
    //lat & lng format=-34.397, 150.644

    //center window on center of Netherlands
    var latlng = new google.maps.LatLng(sDataArray[0][0], sDataArray[0]
[1]);
    var myOptions = {
        zoom: zoom,
        center: latlng,
        mapTypeId: google.maps.MapTypeId.HYBRID
    };
    map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);

    var markersArray = [];


    for (i=0;i<sDataArray.length;i++){

        latlng = new google.maps.LatLng(sDataArray[i][0], sDataArray[i]
[1]);
        var contentString = '<div id="content">' + sDataArray[i][3] +
'</div>';

        //var infowindow = new google.maps.InfoWindow({ content:
contentString });

        var marker = new google.maps.Marker({
            position: latlng,
            title: sDataArray[i][2],
            map: map,
            content: contentString,
            icon: '/images/locationmarker.png'
        });
        markersArray.push(marker);
    }

    for (var i = 0; i < markersArray.length; i++) {
        var marker = markersArray[i];
        var infowindow = new google.maps.InfoWindow({
            content: "holding..."
        });

        google.maps.event.addListener(marker, 'click', function () {
            // where I have added .html to the marker object.
            infowindow.setContent(this.content);
            infowindow.open(map, this);
        });
    }

//THESE 3 LINES IS WHAT I ADDED...DOESNT WORK. ALSO TRIED ADDING IT IN
THE ABOVE FOR FUNCTION (2ND)
    google.maps.event.addListener(map, "click", function () {
        infoWindow.close();
    });


    AutoCenter(markersArray);

} //ShowMarkers

On Oct 15, 9:06 pm, Esa <[email protected]> wrote:
> This is one examplehttp://koti.mbnet.fi/ojalesa/boundsbox/makemarker.htm

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" 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-js-api-v3?hl=en.

Reply via email to