It doesn't work if I pull out the function since the function relies
on the map being defined which is in the load function. Can I define
the map prior to the load?

On Feb 23, 9:24 am, Andrew Leach <[email protected]>
wrote:
> On Feb 23, 5:06 pm, jameslove <[email protected]> wrote:
>
> > I get a "labelclick is not defined" error on this map. I thought the
> > issue might be that I need to move the function labelclick out of the
> > onload, but then I get undefines on "map".
>
> Yes: if you want to run a function from something like a click event,
> the function must be in global scope. If it's inside another function,
> then it only exists while that containing function is being executed.
>
> There's usually no reason for nested functions; generally functions
> can usefully *all* be global. Of course, there are always specific
> instances where nesting functions is the right thing to do, but they
> are rare.
>
> labelclick needs to be global. If you explicitly define as global the
> variables you want to be available to each function (like map and the
> MarkerManager variables) it might work.
>
> Andrew
--~--~---------~--~----~------------~-------~--~----~
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