On Jul 28, 1:45 pm, Joe Plattner <[email protected]> wrote: > Thank you Joseph and Larry. I am very much inexperienced when it comes > to javascript. I saw a lot about the global vs local variables when i > was searching the forum before I posted my question, but was unsure > what it was all about, especially since my V2 version worked just fine > without having to worry about it. > > For future reference for others who are searching about KML toggling > problems. It all came down to changing this line of code. > > Instead of this . . . > var map = new google.maps.Map(document.getElementById("map_canvas"), > myOptions); > > use this . . . > map = new google.maps.Map(document.getElementById("map_canvas"), > myOptions); > > deleting the "var" in front of this line changes the variable from > local to global. My kml files toggle on and off just fine now.
That worked because you already had a "var map;" declaration in the global scope. For IE, if you have a div with id="map", you _have_ to declare the javascript variable explicitly with the "var" keyword. Just an FYI. -- Larry > > This is a great forum. > > Joe -- 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.
