Try this sample. http://marx-tseng.appspot.com/maps/Markers_Infowindow.html
On 7月14日, 上午10時42分, Mike <rotti...@gmail.com> 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. > > 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. > 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 google-maps-js-api...@googlegroups.com. To unsubscribe from this group, send email to google-maps-js-api-v3+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.