Yes, by Jove you've got it.
It seems to fix things. I guess the issue is not why it failed to
work in FF, but why the other browsers worked!
Thanks. I actually fooled with the scope but didn't get the right
combination.
On Nov 24, 9:18 pm, Rossko <[EMAIL PROTECTED]> wrote:
> > function SegmentSelectControl() {}
> > ...
> > var segment_selector = document.createElement("select");
>
> So we define segment_selector in local scope
>
> > GEvent.addDomListener(segment_selector, "change", function(){
> > goToSegment(segment_selector.selectedIndex);
>
> Here we capture segment selector by way of 'function closure'
>
> > function goToSegment(index) {
> > ...
> > segment_selector.selectedIndex = index;
>
> If we arrive here from the change click listener, the javascript
> object segment_selector will be in scope.
> If however we arrive from a map click it won't exist. Different
> browsers now do different things trying to find it ... IE for example
> will search the DOM and find a <select> element that happens to have
> an id set to 'segment_selector' and thinks it will use that
> instead ... luckily it's the right element too.
>
> I think!! This scope stuff is hard ...
>
> The fix should be to declare your object globally outside all
> functions
> var segment_selector;
> then in the function where you create it properly just don't use the
> var
>
> cheers, Ross K
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---