On 18 December 2011 21:15, K Lo <[email protected]> wrote:
> Like so?

No: an array of markers is just that, an array containing markers.

var markers;
var marker = new google.maps.Marker(...);
marker.myAttribute = myAttributeValue; // if you need this
markers.push(marker);

If you want to add a listener to each marker, use a closure:

var marker = createMarker(...); // probably global
marker.myAttribute = myAttributeValue; // if you need this
markers.push(marker);
...
function createMarker(...)
var marker=new google.maps.Marker(...); // local variable
google.maps.event.addListener(marker, 'click', function() { ... });
return 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.

Reply via email to