Hi,

I currently have the following code setup which displays 10 markers on
a map. Each marker is declared as an array element (with the latitude
and longitude plugged in from two arrays above this block of code).
Also, there's a listener which should zoom and center the map to the
marker's location when the marker is double clicked:

var marker = new Array();
        for (var x = 0; x < 10; x++) {
                marker[x] = new google.maps.Marker({
                        position: new google.maps.LatLng(latitude_array[x],
longitude_array[x]),
                        map: map
                });

                google.maps.event.addListener(marker[x], 'dblclick', function() 
{
                        map.setCenter(marker[x].getPosition());
                        map.setZoom(17);
                });
        }

>From this code, the markers display on the map perfectly. However,
whenever I double click a marker on my map, it doesn't do anything,
and Internet Explorer gives me the following script error message:

'marker[...]' is null or not an object
Code: 0
Line: 84 (the line of the listener header)
Char: 4

My markers display just fine on the map, but why isn't the listener
working? Does it have to do something with how I've declared each
marker as an array element?

Any help would be greatly appreciated - thanks!



-- 
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