问题
I have a map described here.
Markers from XML files are loaded only if the checkbox is checked. When you uncheck it, they are still displayed until the page is refreshed. How is it possible to show/hide them when the checkbox value is changed? Simple
onclick="initialize();"
doesn't work and would be very inefficient anyway.
I can't avoid having two xml files and can't use one file with categories instead of them.
回答1:
Here is an example which shows/hides markers based on their categories (again translated from Mike Williams' v2 tutorial):
http://www.geocodezip.com/v3_MW_example_categories.html
Write code to add a category for each of the XML files.
来源:https://stackoverflow.com/questions/12802617/how-to-show-hide-markers-from-xml-file-without-refreshing-the-page