2009-11-02 78 views
0

嗨我创建了一个用户可以输入位置的混搭。当使用IE7时,几乎所有位置都可以进行地理编码,但不能与其他浏览器进行地理编码......您认为这里存在什么问题或者是有这个修复使用JavaScript地理编码,如:?无法在其他浏览器中进行地理编码

function addToMap(response) { 
     var x="Fa, France"; 
     // Retrieve the object 
     if (x.length > 0 && x != "") { 
      if (!response || response.Status.code != 200) { 
       alert("Please enter a valid location.I cannot geocode it!"); 
      } 
      else 
      { 
       place = response.Placemark[0]; 

       // Retrieve the latitude and longitude 
       point = new GLatLng(place.Point.coordinates[1], 
          place.Point.coordinates[0]); 

       // Center the map on this point 
       map.setCenter(point, 4);}}

...更多的代码

+0

您是否尝试过在Firefox中使用FireBug来找出问题出在哪里?尝试通过。 – BobbyShaftoe 2009-11-02 00:40:32

+0

我试过但没有错误.....一切都很好。 – clrence 2009-11-02 00:43:25

+0

您在输入的示例中缺少一些代码。 GClientGeocoder在哪里?你在哪里打电话?我建议你发布“更多代码”或者可能是你的测试页面的链接? – RedBlueThing 2009-11-02 01:25:16

回答

1

在最近版本的API已经成为必须使用数字作为的GLatLng参数() 。在以前的版本中,您可能经常将它们作为String对象离开,就像您正在做的那样。

使用try parseFloat(place.Point.coordinates [1]),parseFloat(place.Point.coordinates [0])

我不知道为什么MSIE7应该是没有什么不同,为什么你在Firebug中没有收到明确的错误消息。也许有些事情你没有告诉我们。

相关问题