Please provide a link to your site. On Tue, May 18, 2010 at 9:02 PM, osama ashraf <[email protected]>wrote:
> Hello Experts: > > This similer code i used in my project was working few days ago but > when i checked it now its not showing properly. > check this out plz n point the error plz. > > <html> > <head> > <meta name="viewport" content="initial-scale=1.0, user-scalable=no"/> > <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> > <title>Directions Practice</title> > <script type="text/javascript" src="http://maps.google.com/maps/api/js? > sensor=false"></script> > > <script type="text/javascript"> > > > var directionDisplay; > var directionsService = new google.maps.DirectionsService(); > var map; > > function initialize() { > directionsDisplay = new google.maps.DirectionsRenderer(); > var karachi = new google.maps.LatLng(24.915871,67.092867); > > var myOptions = { > zoom:15, > mapTypeId: google.maps.MapTypeId.ROADMAP, > center: karachi > } > map = new google.maps.Map(document.getElementById("map_canvas"), > myOptions); > directionsDisplay.setMap(map); > > directionsDisplay.setPanel(document.getElementById("directionsPanel")); > } > > function calcRoute() { > var start = new google.maps.LatLng(24.957916,67.058111); > var end = new google.maps.LatLng(24.915738,67.092948); > var request = { > origin:start, > destination:end, > travelMode: google.maps.DirectionsTravelMode.DRIVING, > optimizeWaypoints: false, > avoidHighways: true, > avoidTolls: true > }; > > directionsService.route(request, function(response, status) { > > if (status == google.maps.DirectionsStatus.OK) { > if (!response.routes[0].copyrights) { > response.routes[0].copyrights = "Copyrights unknown."; > } > directionsDisplay.setDirections(response); > > > // CHECK THESE 4 LINES FIRST 3 ARE RUNNING WELL BUT FOURTH > ONE IS > GIVING UNKNWN. > > // alert(response.routes[0].legs[0].distance.text); // TOTAL > DISTANCE > // alert(response.routes[0].legs[0].duration.text); // TOTAL TIME > // alert(response.routes[0].legs[0].steps[0].distance.text); // > Step1 Distance > // alert(response.routes[0].legs[0].steps[0].text); > > } > }); > > } > > function startUp() { > initialize(); > calcRoute(); > > } > </script> > </head> > <body style="margin:0px; padding:0px;" onload="startUp()"> > <div> > <div><div id="map_canvas" style="float:left;width:70%; height:100%"></ > div> > <div id="directionsPanel" style="float:right;width:30%;height 100%"></ > div> > > </body> > </html> > > -- > 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]<google-maps-js-api-v3%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-maps-js-api-v3?hl=en. > > -- 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.
