Hello,

I have been using Google maps and have been adding multiple markers to
the map using a for loop. However, a problem arises when I attempt to
add info windows to each marker. The info window only shows up on the
final marker.


The lat and long coordinates are passed in an array (latArray[],
longArray[])
[Code]
var initiallatlng = new google.maps.LatLng(latArray[0], longArray
[0]);

        var myOptions = {zoom: 8,center: initiallatlng,mapTypeId:
google.maps.MapTypeId.ROADMAP};

        var map = new google.maps.Map(document.getElementById
("map_canvas"), myOptions);
        var image = 'Images/map/marker.png';


for(var i = 0; i < latArray.length; i ++)
        {
        var latlng = new google.maps.LatLng(latArray[i], longArray
[i]);
        var marker = new google.maps.Marker({position: latlng,map:
map,title:"Task No.1",icon: image });


        var contentString = 'conents HTML'

        var infowindow = new google.maps.InfoWindow({content:
contentString});
        google.maps.event.addListener(marker, 'click', function()
{  infowindow.open(map,marker);});

        }
[\Code]

Any help would be greatly appreciate

--

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