I have changed my code from an example i saw online so that there is now
a separate function which sets the infowindow information. This example
still doesn't work for me fully but it works better. It gets stuck in the
evenListener again though. It will only plot one marker on the map and it
will not have an infowindow attached to it. I just can't figure out these
action listeners. If i take out the listener, it works perfectly and plots
all my markers.
var markersArray = new Array();
while (j < latArray.length)
{
var myLatLng = new google.maps.LatLng(latArray[j], lonArray[j]);
markersArray[j] = new google.maps.Marker({
position: myLatLng,
map: map,
animation: google.maps.Animation.DROP
});
attachInfo(markers[j], j); // call function outside of loop
j++;
}
function attachInfo(marker, num)
{
var infowindow = new google.maps.InfoWindow({ content: "insert
content here"});
google.maps.event.addListener(marker, 'mouseover', function()
{
infowindow.open(map,marker);
});
}
--
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.