On May 25, 5:47 pm, Peanut <[email protected]> wrote:
> I'm trying to get multiple markers loaded from an xml. When you click
> on a marker, it should forward to another page. It works, but it only
> picks the id (which is specified in the xml) of the last record. How
> can i fix this? Is used the code below How can i fix this.

You need to use a createMarker function like Mike demonstrates at
http://www.econym.org.uk/gmap/basic3.htm

Currently you re-use your "marker" variable at each iteration of the
loop, so when the infoWindow is opened, the "marker" in
"marker.openInfoWindowHtml" is always going to be the last one. Using
a function means that you achieve *function closure* on each marker,
in effect ring-fencing each marker together with all its attributes.
Look at Mike's example.

Andrew
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" 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-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to