Hi, just put your javascript below the html code, this will ensure the object has been created before any javascript occurs.
On Tue, Nov 17, 2009 at 11:52 AM, Mike Dunham-Wilkie <[email protected] > wrote: > In my application http://members.shaw.ca/msdwilkie I display a mini > map inside an infowindow. This used to work fine, but last week I > looked at the app again and noticed some strange behaviour. The first > time you click on the marker the infowindow that gets displayed is > empty and a Javascript error occurs. On subsequent clicks everything > works fine. The basic logic is > > var tab1 = new GInfoWindowTab("Info", '<div id="detailmap" > class="bubble"></div>'); > var infoTabs = [tab1]; > marker.openInfoWindowTabsHtml(infoTabs); > ... some more code > dMapDiv = document.getElementById("detailmap"); > detailMap = new GMap2(dMapDiv); > > What's happening is that dMapDiv gets set to null the first time this > code is run (perhaps because the DOM object hasn't had time to be > created yet?), so the last statement (creating the GMap) fails. > > I've noticed that this page > http://mappinghacks.com/projects/gmaps/map_in_box.html > exhibits the same behaviour. Presumably it also worked properly at > some point in the past. > > I'm at a loss for how to ensure that the detailmap DOM div object gets > created before it gets referred to. Any help would be greatly > appreciated! > > ...Mike > > -- > > 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]<google-maps-api%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-maps-api?hl=. > > > -- 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=.
