2009-11-02 75 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中沒有收到明確的錯誤消息。也許有些事情你沒有告訴我們。

相關問題