On 7 May 2011 09:57, dabernathy89 <[email protected]> wrote:
> Oh, I see. Thanks for your help! I'd actually done that on purpose
> because I thought it would make the map a global variable. Didn't
> realize it would break in IE. I'll try something else.

In IE, map is already a global variable, and it's set automatically as
a reference to document.getElementById("map"), which makes it
difficult to do anything else with it. You can't assign a page element
to be an instance of google.maps.Map. What you can do is things like
map.style, or form.fields, but of course they only apply to IE and are
really intended for controlled environments like corporate intranets
where the browser is fixed. It doesn't help the vast majority of site
owners or users.

The cross-browser way of defining a global variable for re-use is to put
  var map;
in global scope. Then you can assign it any value you like. In any
case, using the var keyword is always to be recommended whenever a
variable is defined because it helps to define its scope.

This works in IE because you can always use the var keyword to
re-define a variable.

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