Thanks Larry, that's killed the bug - I moved the var map; out of the function, and renamed the div to "mapid" Now i get no errors and my markers show, but my map itself is just grey... I suspect this might be another IE8 issue so I'll go investigate that, but thanks again
Lucas On Apr 3, 10:40 am, "[email protected]" <[email protected]> wrote: > On Apr 2, 2:27 pm, pr0fess0r <[email protected]> wrote: > > > Hi > > I've modifed the javascript that creates the map variable like this: > > You didn't make it global, you just didn't declare it. > > To make it global, put this: > var map; > > in the global scope. > > > > > Changed > > > if (GBrowserIsCompatible()) { > > var map = new GMap2(document.getElementById("map")); > > > to > > > if (GBrowserIsCompatible()) { > > map = new GMap2(document.getElementById("map")); > > > Because I wanted the map to be accessible to other Javascript > > functions in the header outside of gload() > > > The problem is that > > map = new GMap2(document.getElementById("map")); > > > gives me the JavaScript error > > > Object doesn't support this property or method > > > in IE 8. > > If you don't tell IE to define it globally, by default it creates > global variables named after the ids of the html elements on your page > (as normal, non-standard behavior...). > > > > > How can I access the map variable from another javascript function in > > a way that will keep IE 8 happy? For example, I have a function I use > > for sideclicks which I can only seem to call outside of gload(): > > See above... > > (you could probably also fix the error by changing the name of your > div with id="map"...) > > -- Larry > > > If you need to see this in action the page > > ishttp://www.taranaki.info/visit/theme.php/id/206 > > (it'll break in IE8) > > > Any tips from JavaScript gurus would be appreciated :) > > Cheers > > > Lucas --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
