On Aug 30, 1:54 pm, Michael Femia <[email protected]> wrote: > Mike, > > Thanks for the prompt reply. Your tutorials have been extremely useful > as I attempt to learn how to use the API. I made the suggested changes > and now my script doesn't function. > > The lines in question were updated to the following: > for (var i=0; i<poly.getVertexCount(); i++){points.push( poly.getVertex > (i) ); > for (i=0;i<points.length;i++) > {document.getElementById('directionsData').innerHTML='Coordinate:' + > points[i] + '<br >');} > > } > > I have the script running @http://www.michaelfemia.com/directions.php
I get javascript errors on that page. Try using a javascript debugger or running your code through http://jslint.com/ Error: Problem at line 14 character 35: Use the array literal notation []. var points = new Array(); Problem at line 17 character 109: Missing semicolon. for (i=0;i<points.length;i++){document.getElementById ('directionsData').in... You have an extra ")" in this line (line 17 of your javascript): for (i=0;i<points.length;i++){document.getElementById ('directionsData').innerHTML=points[i].html);} Problem at line 17 character 109: Expected an identifier and instead saw ')'. for (i=0;i<points.length;i++){document.getElementById ('directionsData').in... Problem at line 17 character 109: Stopping, unable to continue. (35% scanned). Implied global: GClientGeocoder 4, GDirections 5, GEvent 6, document 10,11,17 -- Larry > > On Aug 30, 12:58 am, Mike Williams <[email protected]> wrote: > > > > > Wasn't it Michael Femia who wrote: > > > >for (var i=0; i<poly.getVertexCount; i++){ > > > "poly.getVertexCount" is a function reference. You want > > "poly.getVertexCount()" which is the polyline returned by calling that > > function. > > > >for (i=0;i<points.length;i++){document.write(points[i] + "<br >");} > > > Calling document.write() from asynchronous code may well cause problems, > > particularly in MSIE. It will certainly create invalid HTML, since the > > new content will be placed after the </html> which the browser parsed > > synchronously. > > > Use GLog.write() or document.getElementById("info").innerHTML+= > > > -- > > Mike Williamshttp://econym.org.uk/gmap- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
