在 IE8(及更早版本)中显示 Google.map 时出现“0x800a03ea - JavaScript 运行时错误:语法错误”的问题。在其他浏览器和 IE9 及更高版本中一切正常。虽然我读过很多关于 Google.map API 和 IE8 的问题,但我认为问题不在于 Google 的 API。调试时,这是错误发生的地方:
var rawObj = JSON.parse(serializedObject, MapObjectJSONParser);
其中 serializedObject 的内容是:
{"IsReadOnly":true,"Mode":1,"ForeignId":20,"Name":"Rådhuspladsen","Roadname":"Akseltorv","HouseNo":"1","ZipCode":"6000","City":"Kolding","Coordinates":["9.47321891784668;55.4903831481934"]}
{"IsReadOnly":true,"Mode":1,"ForeignId":22,"Name":"Rådhustorvet","Roadname":"Rådhustorvet","ZipCode":"6400","City":"Sønderborg","Coordinates":["9.78874397277832;54.908821105957"]}
{"IsReadOnly":true,"Mode":2,"ForeignId":12,"Name":"Amager fælled","ZipCode":"2300","City":"Amager Vest","Length":1247.88348835266,"Coordinates":["12.5822639465332;55.6549301147461","12.5779724121094;55.6439819335938"]}
并且 MapObjectJSONParser 引用了以下函数:
function MapObjectJSONParser(key, value)
{
if (key === 'Coordinates')
{
var coordinates = new Array();
for (var i = 0; i < value.length; i++)
{
coorItems = value[i].split(";");
coordinates.push(MapCoordinate.Create(parseFloat(coorItems[0]), parseFloat(coorItems[1])));
}
return coordinates;
}
return value;
};
有人知道吗?