Hello there, I've been working on a map, where each marker is clickable, and clicking it causes going to a certain URL, (the page itself - but with a different "img" variable, depending on which marker is clicked. The markers are created through iterations by a "for" command, and the coordinates, as well as title, and the "img" identifier are being stored in an array called "coords". The reason why there's the identifier is that only a part of the img's has a geolocation assigned. I hope this is clear, if you visit the site, you should understand the idea.
This is the link with an example img parameter in the URL: http://redvibes.pl/slovenia/index_pl.php?s=wyprawa&img=35 The only problem is the part of the code responsible for assigning respective URL's to corresponding markers. Below is the function used for creating markers and assigning URL's. "if" goes for the selected 'img' and "else" for the others. var coords = [ [46.056389, 14.507778, 'Lublana, Słowenia', '01'], [46.367778, 14.1125, 'Bled, Słowenia', '21'], [46.476389, 13.721111, 'Planica, Słowenia', '34'], [46.55, 15.6, 'Maribor, Słowenia', '35'], [47.066667, 15.433333, 'Graz, Austria', '42'] ]; for(i=0;i<coords.length;i++) { var punkt = new GLatLng(coords[i][0],coords[i][1]); if (coords[i][3]==img) { var marker = new GMarker(punkt,{title: coords[i][2], icon:ikona1}); mapa.openInfoWindowHtml(new GLatLng(coords[i][0],coords[i] [1]),coords[i][2]); } else { var marker = new GMarker(punkt,{title: coords[i][2]}); } var buff = coords[i][3]; GEvent.addListener(marker,"click",function() { url = "index_pl.php?s=wyprawa&img=" + buff; window.location = url; }); mapa.addOverlay(marker); } The core of the problem is the "buff" variable. It is supposed to assign the identifier "coords[i][3]" to the URL but instead of iterating, it always assigns the same value "42", form the last row of coords. What is wrong with this loop? I know that this could only be my programming error but I thought it would be easier to explain the problem to you geocoders rather than js programmists. I'd appreciate any help. Cheers! -- 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.
