On Apr 29, 3:25 pm, "[email protected]" <[email protected]> wrote: > On Apr 29, 2:14 pm, juddy <[email protected]> wrote: > > > > > > > Hello, > > > I think this may be an issue with my Java rather than Google maps > > itself but if you guys have any suggestions i would really appreciate > > it. I'm using Mikes examples to get simple directions on one of my > > maps. Unfortunately whichever of my markers you select the "daddr" > > value is the same. > > > my page is here:http://www.personal.leeds.ac.uk/~gy07dj/WebGIS/project.html > > > the issue arises once a marker has been selected, the directions tab > > selected and a start address entered. > > > The address it picks up is the last on my sidebar list and i think it > > is due to me looping through all of my markers to add them onto the > > map and when it calls marker.getLatLng() it selects the last marker > > which has been added. Is it possible to define which marker i want > > getLatLng() to use? > > Yes. You are not getting function closure on the "html" variable in > your addMarker function. Declare it with "var html =..." > > It ends up set to the value for the last marker.
For more information on function closure, see this page in Mike Williams' tutorial: http://econym.org.uk/gmap/closure.htm -- Larry --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
