On Sep 23, 6:51 pm, Leigh <[email protected]> wrote: > Larry and Mark, > > OK, you are both correct. I wasn't using IE and didn't notice > the javascript error. I will try and follow Mark's advice to > get some debugging tools, but in the meantime, does either of > you have a simple explanation for what is going on in this code? > Why is j ever becoming equal to 2? The whole thing is in a > simple for loop, with j=0;j<2;j+ > +. How does it ever get to be 2?
The directions call is asynchronous. The loop fires off 2 requests for directions, incrementing j to 2. Sometime later the responses come back. Inside the callback function it tries to access directionDisplay[2] and that doesn't exist. -- Larry > > By the way, I know you are correct. I put some alerts in, and what I > see is j starting at 0, then becoming 1, and then for whatever reason > it is 2 by the time the callback function is called. There must be > something basic I am missing here. I figured that the loop would be > exactly the same as the commented out code below (which works fine) > but obviously it's not. What completely obvious thing am I missing? > > Leigh > > On Sep 23, 6:08 pm, Mark <[email protected]> wrote: > > > > > Larry is spot on. In IE8, with the MS Script debugger, I see > > directionsDisplay[...]' is null or not an object useIndex.html, line > > 53 character 14 > > > As an aside, while I was doing my Googlemaps project, for the > > debugging part I was using MS Script debugger in IE8 to show me errors > > like this and Netbeans IDE to step through code line by line, with > > watches etc. A mixture of the two worked for me. -- 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.
