我的用户(使用IE)报告以下错误:
第43行的堆栈溢出错误。
在我的页面中,我有以下javascript块来初始化谷歌地图。这是完整的代码:
var map;
function initializeMap() {
var locations = [];
var baseLat = 39.828175;
var baseLng = -98.5795;
@if (Model.Clubs.Any())
{
@:baseLat = @Model.Clubs.FirstOrDefault().latitude;
@:baseLng = @Model.Clubs.FirstOrDefault().longitude;
}
@foreach (var club in Model.Clubs)
{
var content = string.Format("<span style='font-weight:bold; font-size: small;text-align:left;'>{0}<br/>{1}, {2}</span>", club.name, club.city, club.state);
var link = string.Format("<span style='text-align:left;'><a href='/Search/Details?state={0}&cbsa={1}&clubid={2}' class='moreDescription'>Details</a></span>", club.state, club.cbsa_code, club.id);
@:locations.push(["@Html.Raw(content)", @club.latitude, @club.longitude, 4, "@Html.Raw(link)"]);
}
map = new window.google.maps.Map(document.getElementById('map'), {
zoom: 7,
center: new window.google.maps.LatLng(baseLat, baseLng),
mapTypeId: window.google.maps.MapTypeId.ROADMAP
});
var infowindow = new window.google.maps.InfoWindow();
var marker, i;
for (i = 0; i < locations.length; i++) {
marker = new window.google.maps.Marker({
position: new window.google.maps.LatLng(locations[i][1], locations[i][2]),
map: map
});
window.google.maps.event.addListener(marker, 'click', (function(marker, i) {
return function() {
infowindow.setContent(locations[i][0] + '<br/>' + locations[i][4]);
infowindow.open(map, marker);
};
})(marker, i));
}
}
这是第43行:position: new window.google.maps.LatLng(locations[i][1], locations[i][2])
ReSharper还说“声明隐藏了外部范围的变量标记”和“声明隐藏变量i来自外部范围”
有关导致溢出的原因的任何想法?
谢谢!