Larry is correct in that it is a closure problem. Take a look at Daniel's write up of the issue and see if that makes things clearer: http://groups.google.com/group/google-maps-js-api-v3/browse_thread/thread/f40390e4a6ba89e9/25a246d92f93e9ea#25a246d92f93e9ea
Chad Killingsworth On Jul 13, 10:20 pm, Mike <[email protected]> wrote: > Thanks for the reply Larry, but not really. I am confused by this > unroll stuff :/ > > On Jul 13, 10:57 pm, "[email protected]" <[email protected]> > wrote: > > > > > On Jul 13, 7:42 pm, Mike <[email protected]> wrote: > > > > Hi, > > > > I have a map with multiple markers loading from XML. > > > > The markers load properly, but no matter which marker I click, the > > > same bubble pops up on the same marker. > > > You aren't getting function closure on the markers. > > Pitfall number 3 on Mike Williams' (v2) Tutorial: > > The Basics - Part 1 Markers with info > > windowshttp://econym.org.uk/gmap/basic1.htm > > > > Here is my loop: > > > ===================== > > > > var markers = > > > data.documentElement.getElementsByTagName("marker"); > > > for (var i = 0; i < markers.length; i++) > > > { > > > var bubbletext = "<p>"+ markers[i].getAttribute("club") +" :: > > > "+ markers[i].getAttribute("stat") +"</p>"; > > > var latlng = new > > > google.maps.LatLng(parseFloat(markers[i].getAttribute("lat")),parseFloat(ma > > > rkers[i].getAttribute("lng"))); > > > var infowindow = new google.maps.InfoWindow({content: > > > bubbletext}); > > > var marker = new google.maps.Marker({position: latlng, map: > > > map}); > > > google.maps.event.addListener( > > > marker, "click", function() { > > > infowindow.open(map, marker); > > > }); > > > } > > > }); > > > > ===================== > > > > Any help would be appreciated. > > > Does this help:http://www.geocodezip.com/v3_MW_example_map3.html > > > -- Larry > > > > Thanks, Mike -- 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.
