Bart Gottschalk


The code included below works fine in Firefox but I'm having trouble in IE.

When I load this page in IE and then click "Display Route" the http response is

HTTP/1.1 200 OK
Connection: close
Date: Thu, 25 Jan 2007 00:37:31 GMT
Server: Microsoft-IIS/6.0
P3P: P="BUS CUR CONo FIN IVDo ONL OUR PHY SAMo TELo"
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: no-cache
Pragma: no-cache
Expires: -1
Content-Type: text/html; charset=utf-8
--------------: ----

Problem is that no route info is returned and therefore the map doesn't display the route. In Firefox the complete route info is returned and the route displays.

Am I doing something wrong Anyone else having this problem

Thanks again!

Bart

<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Reverse Route Test</title>
<script src="
http://dev.virtualearth.net/mapcontrol/v3/mapcontrol.js"></script>

<script>

var map = null;

function GetMap(){
// If the browser is Firefox get the version number
var ffv = 0;
var ffn = "Firefox/"
var ffp = navigator.userAgent.indexOf(ffn);
if (ffp != -1) ffv = parseFloat(navigator.userAgent.substring(ffp + ffn.length));
// If we're using Firefox 1.5 or above override the Virtual Earth drawing functions to use SVG
if (ffv >= 1.5) {
Msn.Drawing.Graphic.CreateGraphic=function(f,b) { return new Msn.Drawing.SVGGraphic(f,b) }
}

map = new VEMap("myMap");
map.LoadMap();
}

function displayRoute(){
map.GetRoute( "55408", "55419");
}

function reverseRoute(){
map.GetRoute( "55419" , "55408");
}

</script>
</head>
<body onload="GetMap();">
<div id='myMap' style="position:relative; width:400px; height:400px;"></div>
<a href=//" onclick="displayRoute();">Display Route</a>
<a href=//" onclick="reverseRoute();">Reverse Route</a>
</body>
</html>





Re: map.GetRoute() Problem

Derek Chan


Why are you putting the onclick handler on a hyperlink Would make more sense to replace them with buttons like this:

<INPUT id="find" type="button" value="display Route" name="display Route" onclick="displayRoute();">
<INPUT id="find2" type="button" value="reverse Route" name="reverse Route" onclick="reverseRoute();">

But anyways i noticed your missing a quote in the href, so this below works for me in IE6

<a href="//" onclick="displayRoute();">Display Route</a>
<a href="//" onclick="reverseRoute();">Reverse Route</a>






Re: map.GetRoute() Problem

Bart Gottschalk

Derek,

Thanks for your response. The missing quote was the issue. This code was an example of a much more complex site I'm building but the same problem was happening, so this code isn't actually going to production. I modified the <a href code in the actual project and that fixed things.

Thanks!

Bart