У меня есть этот код, который вычисляет маршрут между местами буксировки
function createDrivingRoute()
{
$("#nav").html("");//CLEAR HTML
if (!directionsManager) {
createDirectionsManager();
}
directionsManager.resetDirections();
// Set Route Mode to driving
directionsManager.setRequestOptions({
drivingPolylineOptions:{
strokeColor: new Microsoft.Maps.Color(150, 255, 51, 51), strokeThickness: 8
},
distanceUnit:
Microsoft.Maps.Directions.DistanceUnit.kilometers,
routeOptimization: Microsoft.Maps.Directions.RouteOptimization.shortestDistance,
routeMode: Microsoft.Maps.Directions.RouteMode.driving
});
var seattleWaypoint = new Microsoft.Maps.Directions.Waypoint({
address: fromtxt ,location: new Microsoft.Maps.Location(plat, plng)
});
directionsManager.addWaypoint(seattleWaypoint);
var tacomaWaypoint = new Microsoft.Maps.Directions.Waypoint({
address: totxt, location: new Microsoft.Maps.Location(mlat, mlng)
});
directionsManager.addWaypoint(tacomaWaypoint);
// Set the element in which the itinerary will be rendered
directionsManager.setRenderOptions({
itineraryContainer: document.getElementById('nav')
});
directionsManager.calculateDirections();
}
Где "plat, plng, mlat, mlng" - глобальная переменная;«Я» установить их, используя метод «attr» jquery.Этот пример работает нормально для всех браузеров, кроме ie7 и ie8.
Это дает мне эту ошибку:
line:2
char :141845
Error : 'undefined' is null or not an object
code:0
, и она перестает работать
//
Используя консоль Firefox, я получаю эту ошибку, но она все еще работает
[10:37:03.054] uncaught exception: InvalidOperation: Matrix3D.invert