Hi,
I'm quite new to Javascript and the GoogleMaps API.. I have a problem with a map that I'm populating with markers.. I have a combo box that allows the user to select a marker and it highlights the marker on the screen for them by popping up an info box for it.
Using Mike Williams excellent tutorial on the google maps API (http://econym.org.uk/gmap/index.htm) I've gotten off to a good start and have most of my application working.
The problem can be distilled down into this link, which is a mildly modified version of one of Mike William's examples:
http://duncanmargetts.com/map3.html
On the initial load of the page you can see 100 markers populated.. an event listener is created on GEvent for each marker and when the user selects an item from the Combo Box the info box is displayed..
I have added a SetInterval that redraws the map every 8 seconds.. after the map is redrawn the Combo Box still loads with the correct contents but the Event Listener won't fire.. no pop up info box is seen.
Steps to recreate:
Follow the link (http://duncanmargetts.com/map3.html)
Immediately select an item from the drop down box at the bottom of the screen... observe that the associated marker has its pop up box appear.
Wait at least 8 seconds for the setInterval to fire..
Select an Item from the ComboBox.. observe that nothing happens :(
A bit of informatin about the code is:
drawMap() is called when the page first loads.. drawMap() is called every 8 seconds thereafter by SetInterval..
drawMap retrieves an XML file with the details of 100 markers and for each marker calls "createMarker".. along the way select_html, a string, is built up and at the end of the iteration of the markers it is placed in a div ("selection") using document.getElementById("selection").innerHTML = select_html;
I'm guessing maybe I'm not clearing old listeners.. perhaps.. I've looked at GEvent.clearListeners but cant work out if a) this is what I need or b) how to integrate it into my code.
Thank you so much for reading this far.. if you have any ideas I'd certainly be very grateful..
With many thanks,
Duncan.