Google Map JavaScript API V3, does not show road direction in Chrome, Safari and Opera.

110 views
Skip to first unread message

Masum Ahmed

unread,
Feb 7, 2012, 7:28:27 AM2/7/12
to google-map...@googlegroups.com
I am here new. Please help me. I set Google map road direction on my page. But Road map only shows Mozilla and IE.
My JS code is...

function init_map() {
map = new google.maps.Map(document.getElementById("map"), {
zoom: 4,
mapTypeId: 'roadmap',
//scrollwheel: false,
mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU}
});
infoWindow = new google.maps.InfoWindow();
}

function calcRoute() {
  var end=document.getElementById("end").value;
var start=document.getElementById("start").value;
directionsDisplay = new google.maps.DirectionsRenderer();
var settings ={
zoom: 4,
mapTypeId: 'roadmap',
mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU}
};
var map = new google.maps.Map(document.getElementById("map"),settings);
directionsDisplay.setMap(map);
var request ={
origin:start,
destination:end,
travelMode: google.maps.DirectionsTravelMode.DRIVING
};
directionsService.route(request, function(response, status) 
{
if (status == google.maps.DirectionsStatus.OK) 
{
directionsDisplay.setDirections(response);
}
else {
alert('Error: ' + status);
 }
});
}


When i clicked on "Get Direction" it called "calcRoute" function.

JKurtock

unread,
Feb 7, 2012, 11:08:52 AM2/7/12
to Google Maps JavaScript API v3
I don't see "Get Direction" on that web page. The "Search" button is
a form submittal. You have a function named "calcRoute" buried deep
within your included javascript files, but I was unable to find that
it was referred to outside of the function (meaning, there is no call
to that function.)

Did I get the wrong link?
Reply all
Reply to author
Forward
0 new messages