Peter wrote:
> Thanks Mike,
>
> Sorry if it sounds rather obvious, but I'm a relative JS newbie who
> has melded about 3 tutorials into 1. So will removing
> "map.clearOverlays();" fix the problem?

Only if you don't want to remove the overlays there...

> Or is it a little bit more
> complex than that (to make the "map" variable global)?


http://groups.google.com/group/Google-Maps-API/search?group=Google-Maps-API&q=map+global&qt_g=Search+this+group

change this line in your load function:
var map = new GMap2(document.getElementById("map"));
to:
map = new GMap2(document.getElementById("map"));

and outside of the load function (just before it works), add this:
var map;

That declares the map variable in the global context.  The load
function will initialize it.

  -- Larry



>
>
> Cheers for taking the time!
>
>
> On Aug 30, 3:15�pm, Mike Williams <[EMAIL PROTECTED]> wrote:
> > If you look at your Javascript error it's a bit obvious.
> >
> > "map is not defined" on this line
> > � � � � �map.clearOverlays();
> >
> > You need to make your "map" variable global instead of local to your
> > "load()" function.
> >
> > --http://econym.googlepages.com/index.htm
> > The Blackpool Community Church Javascript Team
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to