On Apr 15, 9:50 am, andreivasile <[email protected]> wrote: > Hi > > A page on our website displays a Google map and loads elements (lines, > polygons) from a kml file. Is there a way to hide those elements from > a single click (javascript way)? > > I tried map.removeOverlay but no luck... > > gx variable is defined inside initialize() function > > function initialize() { > ... > var gx = new GGeoXml('referenceToMyKMLfile'); > map.addOverlay(gx); > ... > > } > > function toggleGeoXML() { > if (document.getElementById("hideKML").checked) { > map.removeOverlay(gx); > } > else { > map.addOverlay(gx); > } > > } > > Then this checkbox calls the togglrGeoXML() function. > > <input type="checkbox" id="hideKML" onclick="toggleGeoXML();">Hide > > Obviously the map with those elements read from the KML displays and > "stubbornly" stay on, regardless I check on and off that box a million > times ;-) >
Where is your map? http://groups.google.com/group/google-maps-api/web/suggested-posting-guidelines http://groups.google.com/group/Google-Maps-API/web/why-including-a-link-is-critical Similar code works for me at: http://www.geocodezip.com/GenericMapBrowser.asp (not kml, but I have seen similar code work for kml). -- Larry -- 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.
