I should have tested IE before posting the previous workaround, but
here is the workaround to counter the error from IE - Object doesn't
support this property or method:

 if(navigator.appName == 'Microsoft Internet Explorer')
 {
   directionsDiv.attachEvent('onclick', function(event){
    mWorkAroundIE();
   });
 }
 else
 {
   directionsDiv.addEventListener(event, 'click', function(event){
    mWorkAround();
   });
 }

function mWorkAroundIE()
{
        if(firstTimeOnPage == 1)
        {
                // alert('gets here');
                var seT = setTimeout("mWorkAroundWaitIE()", 250);
        }
}

function mWorkAroundWaitIE()
{
        var mStart = document.getElementById('start');
        mStart.focus();
        mStart.select();

        var tempZ = map.getZoom();
        map.setZoom(parseInt(tempZ-1));
        firstTimeOnPage++;
}

And it works in all the browsers that I have tested on Mac and Win
(Safari (Mac), FF, Opera and IE(Win));

On Jan 11, 10:35 am, kronus <[email protected]> wrote:
> Here's the work around that I made:
>
> Within my Directions function, I add an eventlistener to the
> directions div:
>
>  directionsDiv.addEventListener(event, 'click', function(event){
>    mWorkAround();
>  });
>
> Which listens for a click on the div. I have also added an onclick to
> the div calling the same function, so I do not know which one is
> calling the function. It did not work with just the onclick on the
> div, so I am assuming it is the eventlistener that is firing the
> function mWorkAround.
>
> mWorkAround sets a timeout to allow the map to 'freak out' followed by
> calling mWorkAroundWait:
>
> function mWorkAround()
> {
>         if(firstTimeOnPage == 1)
>         {
>                 // alert('gets here');
>                 var seT = setTimeout("mWorkAroundWait()", 250);
>         }
>
> }
>
> function mWorkAroundWait()
> {
>         var mStart = document.getElementById('start');
>         mStart.focus();
>         mStart.select();
>
>         var tempZ = map.getZoom();
>         map.setZoom(parseInt(tempZ-1));
>         map.setZoom(parseInt(tempZ+1));
>         firstTimeOnPage++;
>
> }
>
> I couldn't get the addEventListenerOnce to work as I would think it
> would work, so the var firstTimeOnPage is set to 1 when the page
> loads. This is my way of running the function only once.
>
> I did not want this to fire each time the user clicks on a step.
>
> Hope this helps someone out there.
>
> On Jan 11, 9:38 am, kronus <[email protected]> wrote:
>
>
>
> > One thing that I would like to add.
>
> > After clicking and the map goes to somewhere that you do not expect it
> > to go to, if you click once to zoom out, then the map is correct at
> > that point.
>
> > I tried to zoom to see where the map was now centered, to get an idea
> > if the lat, lng were maybe set to negative instead of positive or vice
> > versa, but the map would go to the correct coordinates.
>
> > Is there a way to place an eventlisteneronce on the directions way
> > point clicks?
>
> > If there is, then I could just have the map zoom out once and zoom
> > back, which would offer a work around.
>
> > On Jan 11, 9:27 am, kronus <[email protected]> wrote:
>
> > > Yes, I did see the report and I was hoping there were some
> > > workarounds.
>
> > > I tried the 3.4 but it didn't work for me.
>
> > > I saw some blog that spoke of a second pass or something to that
> > > affect, but I never found any details on what they were referring to,
> > > so I thought I would post this, in the hopes of someone giving me some
> > > more options.
>
> > > On Jan 10, 5:42 pm, Martin™ <[email protected]> wrote:
>
> > > > I have already reported this as a bug:
>
> > > >http://code.google.com/p/gmaps-api-issues/issues/detail?id=3738
>
> > > > Looks like my report has been ignored!
>
> > > > Ìartin.
>
> > > > On Jan 10, 6:32 pm, kronus <[email protected]> wrote:
>
> > > > > Hi guys and thanks for being here to help us.
>
> > > > > Here's the app that I am working on 
> > > > > --http://kronusproductions.com/test_dg/first.php
>
> > > > > You can either click on the Acton school district (only five schools
> > > > > so it will not take long to load)
>
> > > > > or you can go 
> > > > > directlyhttp://kronusproductions.com/test_dg/first.php?schoolid=2&districtNam...
>
> > > > > After the five markers have loaded and the bounds set, click on the
> > > > > 'VASQUEZ HIGH' marker, which will fill the destinations text field.
>
> > > > > I test with the address of '11030 Hartsook St, North Hollywood, CA' in
> > > > > the start text field, followed by clicking on the "Get Directions"
> > > > > button, which will produce the directions perfectly.
>
> > > > > When I click on Lankershim in the first way point (is that what it is
> > > > > referred as?), then the map goes to some obscure location, but if I
> > > > > click a second time, then it works.
>
> > > > > I have tested on both Mac & Win (Safari, FF, Opera, IE)
>
> > > > > Is there anything I can do on my end?
>
> > > > > Thanks in advance

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" 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-js-api-v3?hl=en.

Reply via email to