I have a problem passing values to bing maps route service in IE7
I have this code which calculate route between tow places
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();
}
Where "plat, plng, mlat, mlng" are global variable; "i" set them using jquery "attr" method. This example is working fine for all browser execept ie7 and ie8.
It gives me this error:
开发者_如何学编程line:2
char :141845
Error : 'undefined' is null or not an object
code:0
and it stop working
//
Using firefox console i get this error but it still working
[10:37:03.054] uncaught exception: InvalidOperation: Matrix3D.invert
for all who are suffering with this issue and came to here through google to find that there are no answer
just parse your variables to float before you send it
like that
parseFloat(plat);
and it should work although i think Microsoft developers should cast any received variable to them API for the correct form!
精彩评论