我正在Google地圖上繪製多段線和多邊形。它們在Internet Explorer 9中正確顯示,但不在IE8或IE7中顯示。我遇到過幾篇文章,討論在IE9中修復的數組「懸掛逗號」問題,這可能與我遇到的問題有關,但我不明白我會如何遇到這種情況因爲我的代碼是如何工作的。我創建「google.maps.LatLng」對象並將它們「推」到一個數組中。我在創建「google.maps.Polygon」對象時將該數組作爲「路徑」參數傳遞。我沒有任何通過在列表中的項目之間插入逗號來構建數組的代碼。在Google Maps for IE8或IE7中未顯示折線和多邊形
var polygonPoints = new Array();
var point1 = new google.maps.LatLng(myLat1, myLong1);
polygonPoints.push(point1);
var point2 = new google.maps.LatLng(myLat2, myLong2);
polygonPoints.push(point2);
var point3 = new google.maps.LatLng(myLat3, myLong3);
polygonPoints.push(point3);
var myPolygon = new google.maps.Polygon({
path: polygonPoints,
strokeColor: "#FFFF00",
strokeOpacity: 1.0, strokeWeight: 2,
fillOpacity: 0.0
});
我怎樣才能獲得多邊形在IE8和IE7說明了什麼? (多義線並不顯示,但是標記可以。)