> var ContentID = myContent[i];
>
> google.maps.event.addListener(markers[i], 'click',
> function() {
> info.setContent(ContentID);
You're not getting closure on ContentID. When the loop finishes,
ContentID is set to the last item. Later, when any of the click
listeners are triggered, they all use the same ContentID.
See this example
http://code.google.com/apis/maps/documentation/javascript/examples/event-closure.html
the important feature is removing the listener creation to a seperate
function, which allows for function closure on the content. It's not
an easy concept.
--
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.