On Dec 7, 11:30 am, Hari <[email protected]> wrote:
> I am following the demo listed here -
>
> http://gmaps-samples-v3.googlecode.com/svn/trunk/single-infowindow/si...
>
> The following lines are repeated thrice in the example -
> //------------------------------------------------------------------------
> var marker2 = new google.maps.Marker({
>     map: Demo.map,
>     position: new google.maps.LatLng(37.787814,-122.40764),
>     draggable: true
>   });
> google.maps.event.addListener(marker2, 'click', function() {
>     Demo.openInfoWindow(marker2);
>   });
> //------------------------------------------------------------------------
>
> I instead want to put it in a loop, and am trying the following --
>
> //----------------------------------------------------------------------
> var locations = [
> ['ALBANY NWFO UNIV', 42.692500000000003, -73.830830000000006],
> ['Guilderland', 42.721240000000002, -74.017011999999994],
> ['ALBANY AP', 42.74306, -73.809169999999995],
> ['VOORHEESVILLE DEPOT', 42.700000000000003, -73.950000000000003],
> ['CEDAR HIL', 42.216670000000001, -73.766670000000005],
> ['BERNE 5 SW', 42.583329999999997, -74.183329999999998]
> ];
>
> var markerArray = new Array();
>
> for (var i = 0; i < locations.length; i++) {
>
> markerArray(i) = new google.maps.Marker({
>     map: Demo.map,
>     position: new google.maps.LatLng(locations[i][1], locations[i]
> [2])),
>     draggable: true
>   });
> google.maps.event.addListener(markerArray(i), 'click', function() {
>     Demo.openInfoWindow(markerArray(i));
>   });
> //---------------------------------------------------------------------
>
> This creates the 6 markers, however clicking on them doesn't open up
> an InfoWindow. Am I missing something? I write out the above 6 times
> and it works just fine. Any suggestions?

Maybe use a different example?
http://www.geocodezip.com/v3_markers_infowindows.html

  -- Larry

>
> -- hari

-- 
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 [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-js-api-v3?hl=en.

Reply via email to