On Wed, May 18, 2011 at 11:56 AM, Rossko <[email protected]> wrote:

> > var map;
>
> Thats an empty variable called 'map' in global scope
> ...
>
> >     overlay.setMap(map);
>
> This attempts to add an overlay to the empty variable in global scope.
> No javascript error reported?


It may just be a no-op. The code is basically doing this:

overlay.setMap( undefined );

That may (the docs don't say) be treated the same as:

overlay.setMap( null );

So it would remove the overlay from a map if it's on one, or do nothing if
it's not. (The docs don't make this clear either, but I suspect this isn't
treated as an error.)

Of course, that's not what the OP wants to have happen - and you already
showed *why* map is undefined - but it would explain the lack of a JS error.

-Mike

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