SitePoint Sponsor |
|
User Tag List
Results 1 to 2 of 2
-
Apr 2, 2007, 02:40 #1
Javascript and Microsoft Virtual Earth
Hi, I'm making a script for my works website that will use Microsoft Virtual Earth to give users directions. The proble is the Virtual Earth SDK uses javascript and I haven't got a clue.
Here's my code:
Code:<html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script src="http://dev.virtualearth.net/mapcontrol/v4/mapcontrol.js"></script> <script> var map = null; function GetMap() { map = new VEMap('myMap'); map.LoadMap(); map.GetRoute('DH2 1DD', 'ne215tl', null, null, onGotRoute); } function onGotRoute(route) { var routeinfo="Route info:\n\n"; routeinfo+="Total distance: "; routeinfo+= route.Itinerary.Distance+" "; routeinfo+= route.Itinerary.DistanceUnit+"\n"; var steps=""; var len = route.Itinerary.Segments.length; for(var i = 0; i < len ;i++) { steps+=route.Itinerary.Segments[i].Instruction+" -- ("; steps+=route.Itinerary.Segments[i].Distance+") "; steps+=route.Itinerary.DistanceUnit+"\n"; } routeinfo+="Steps:\n"+steps; alert(routeinfo); } </script> </head> <body onload="GetMap();"> <div id='myMap' style="position:relative; width:400px; height:400px;"></div> </body> </html>
What is the best way to do what I want?
Would it be possible to somehow convert the routeinfo variable to an asp variable (then at least I'll an idea of what I'm doing)?Last edited by Jmz; Apr 2, 2007 at 02:42. Reason: added [code] tags
-
Apr 3, 2007, 01:27 #2
I managed to get this fixed, if anybody else is having a similar problem PM me and I'll be happy to help
Bookmarks