> I think im close, dont show any errors but still not able to get the markers
> removed.

You have
 function setMarkers(map, locations) {
...
           for (var i = 0; i < locations.length; i++) {
               ....
               var marker =
createMarker(map,myLatLng,court[0],court[0],court[3]);
    }
    markersArray.push(locations);

'locations' is just a placeholder here.   You actually call this
function like this
    setMarkers(map, courts);
so that it will use the contents of 'courts', which is "<b>Douglas
County Municipal Courts..." and so on.

So, you push the array of 'locations' onto markersArray[].
markersArray[0] now contains an array beginning   "<b>Douglas County
Municipal Courts..."
It's not an array of map marker objects, it will not help you remove
any markers from the map.

Here you create a map marker object (one at a time)
       var marker = createMarker(map ....
so just after that would be the place to push them onto
markersArray[], one at a time?

Okay, so now from your button you call
   clearMarkers(map, locations, markersArray)
'locations' is still undefined as we discussed before, so I've no idea
why you would still want to pass that.  But lets follow through...
'markersArray' is no good as we know, but when you've fixed that how
will it get used ...
     function clearMarkers (map, locations, markersArray) {
             if (locations) {
                   for (i in locations) {
                   locations[i].setMap(null); ....
umm, turns out we don't use markersArray at all.
We're not using 'map' in here either, so might as well stop passing
that around.
You can rewrite clearMarkers something like
     function clearMarkers ( someArrayOfMarkers ) {
             if (someArrayOfMarkers) {
and so on.
Then call it from your button simply with clearMarkers(markersArray);

> Here is the code I am using

No thanks, can't run a debugger on that.

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