I have a dynamic map application which allows a user to enter in a
starting address and it shows the directions a preselected location on
the map. It is working properly in all browsers except IE6, so it
seems to be an IE6 specific bug. Can anybody help me fix this?
The issue is that I have code which initializes the map, and it starts
at a specific set of coordinates. After that it sets up a direction
service
The problem is that the map initializes properly and shows the LatLng
specified in the InitDirectionsMap function (30.3842, -97.7174), but
then it never changes to the directions. However, the text directions
table shows properly. And if I click on a text direction, the popup
bubble sometimes shows up on the map. I think it's some kind of issue
with the map tiles not updating, but I don't know how to debug it any
further in IE6.
Below are the relevant portions of the code. This is part of a much
more complex application, but I think this is the relevant part.
HTML
<a href="#getdir" onclick="GetDirections(); return
false;" class="ir btn btn-directions-lg">Get Directions</a>
<div id="turn-by-turn" class="unit size1of3 crop">
</div>
<div id="direction-map" class="unit size2of3">
</div>
JAVASCRIPT
var directionDisplay;
var directionService;
var directionMap;
function GetDirections() {
var request = {
origin: $('.tbFrom').val(),
destination: new
google.maps.LatLng(targetLocation["latitude"],
targetLocation["longitude"]),
travelMode: google.maps.DirectionsTravelMode.DRIVING
}
alert("created request");
if(directionMap == null) {
InitDirectionMap();
}
alert("after init");
directionService.route(request, function (result, status) {
if (status == google.maps.DirectionsStatus.OK) {
alert("status ok, setting directions");
directionDisplay.setDirections(result);
}
else {
alert("directions not ok");
}
});
}
function InitDirectionMap() {
alert("InitDirectionMap");
directionService = new google.maps.DirectionsService();
directionDisplay = new google.maps.DirectionsRenderer();
var myLatlng = new google.maps.LatLng(30.3842, -97.7174);
var myOptions = {
zoom: 16,
center: myLatlng,
disableDefaultUI: true,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
directionMap = new
google.maps.Map(document.getElementById("direction-map"), myOptions);
directionDisplay.setMap(directionMap);
directionDisplay.setPanel(document.getElementById("turn-by-
turn"));
}
--
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.