Hey Larry - ok, thanks that looks good. Neat trick to borrow the xml directly from my website. I've got it working now on my localhost computer (will upload in a few minutes)
So here's what's different. Like Rossko said it required moving the function of creating the markers and listeners out of the XML loop into a separate function. Arg! If anyone wants me to shoot them the final code, send me a message via the contact me page from www.pindi.ca website and I can send it to them. Thanks! On Apr 27, 3:52 pm, "[email protected]" <[email protected]> wrote: > On Apr 27, 12:46 pm, "[email protected]" <[email protected]> > wrote: > > > > > On Apr 27, 12:25 pm, jpindi <[email protected]> wrote: > > > Thanks, Larry. > > > > I conceptually get what the problem is, in that there is only one > > > marker variable, and it keeps getting overwritten as new markers are > > > generated by the xml. Then when trying to go back to the first > > > 'marker' it ends up referring to the 'last' marker. So the question is > > > how to prevent this from happening. > > > > I read the two articles you referred to and in the first one, he tells > > > you what not to do, but doesn't provide an example of what to do. The > > > second article are not exactly the same commands I am using. > > > > So adding something like: > > > > var idmarker = (markers[i].getAttribute("id")); > > > and then this or some variation of: > > > var marker = new GMarker(latlng, idmarker, markerOptions); > > > > ...causes a failure in creating the markers. What I need is a way of > > > making sure the addListener refers to each marker not just the last > > > one. How do I do that? Ideas, anyone? > > > use a createMarker function so you get function closure on your > > "marker" variable. > > Like this:http://www.geocodezip.com/studio401_ca_index2d.html > > -- Larry > > > > > > > > Again, thanks a million for any help. > > > > -jpindi > > > > > Sounds like pitfall #3 on this page of Mike Williams' tutorial: > > > > Part 1 Markers with info windowshttp://econym.org.uk/gmap/basic1.htm > > > > > and it is... > > > > > For further study, see this page on function closure: > > > > Part 3 Function Closurehttp://econym.org.uk/gmap/closure.htm > > > > > -- Larry > > > > > > I think there is some value that I am not passing along to each > > > > > marker. Each marker has an ID number which is random, and is unique > > > > > enough that can be used but I am not sure how to link it up with the > > > > > listener event. It is at about line 100: > > > > > > var idmarker = (markers[i].getAttribute("id")); > > > > > > Anyway, you'll see what I mean if you go to this page, and start > > > > > mousing over all the markers. > > > > > >http://www.studio401.ca/index2.php > > > > > > Thanks in advance for any help. > > > > > > -- > > > > > 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 > > > > > athttp://groups.google.com/group/google-maps-api?hl=en. > > > > > -- > > > > 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 > > > > athttp://groups.google.com/group/google-maps-api?hl=en. > > > > -- > > > 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 > > > athttp://groups.google.com/group/google-maps-api?hl=en.-Hidequoted text - > > > > - Show quoted text - > > > -- > > 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 > > athttp://groups.google.com/group/google-maps-api?hl=en.-Hide quoted text - > > > - Show quoted text -- Hide quoted text - > > > - Show quoted text - > > -- > 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 > athttp://groups.google.com/group/google-maps-api?hl=en. -- 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.
