-1

有以下代码,在 Chrome、Safari、Firefox 中运行良好,但像往常一样 IE 不玩游戏。我收到以下神秘错误:

'a' 为空或不是 objectLine:27Char:1111Code:0URI:http ://maps.gstatic.com/intl/en_us/mapfiles/api-3/14/12/main.js

有任何想法吗?

<script type="text/javascript">
//Google map


function initialize() {

  var myOptions = {
    scrollwheel: false,
    mapTypeId: google.maps.MapTypeId.ROADMAP
  };

  // Create map on #map_canvas
  var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

  // Define boundarys
  var markerBounds = new google.maps.LatLngBounds();

  var countries = [

  {
    title: 'M11 Moscow to St. Petersburg',
    lat: 55.938818,
    lon: 37.429733,
    marker: 'http://roadfree.org/images/map_markers/icon_map-marker.png',
    content: "<h4>M11 Moscow to St. Petersburg</h4><p>The M11 is a 650 km highway project aimed at connecting Moscow to Saint Petersburg. Despite several options proposed to build it, it was decided in 2009 that the road would run through Khimki Forest (between the 18 and 58 km marks), a centuries-old oak trees forest and host of many species of wildlife.</p><p>This decision provoked number of protests. On December 24 2011, nearly 100.000 persons rallied in Moscow, the largest demonstration in Russia since the fall of the Soviet Union.</p><p>The European Bank for Reconstruction and Development and the European Investment Bank, initially part of project, decided in 2011 to withdrawn their support.</p><p>The part of the road going through the forest is funded by private consortium including French giant construction group Vinci. Environmentalists and local residents denounce a case of corruption aimed at enriching property developers eager to increase housing facilities at the outskirts of Moscow.</p><p>The case of the M11 is also notorious because of the many reports of police brutality, intimidations, beatings and death of protesters and journalists.</p><p>The highway is due to open in 2014</p>"
  }, {
    title: 'Indonesia',
    lat: 1.576339,
    lon: 100.969849,
    marker: 'http://roadfree.org/images/map_markers/icon_map-marker_blue.png',
    content: "<h4>Indonesia</h4><p>On the island of Sumatra in Indonesia, one of the world's richest ecosystem and host of the critically endangered sumatran elephant, rhinoceros, tiger and orangutan, road-building through intact forests and protected areas is a recurrent theme.</p><p>Kerinci Seblat,</p><p>The 1.33m ha Kerinci Seblat National Park (KSNP) in West Sumatra, is strictly protected under Indonesian law and an ASEAN Heritage Site and a UNESCO World Heritage Site.</p><p>Despite being illegal, plans to open four roads (up to 12 meters wide) through the park have been regularly supported by Aceh's consecutive governors for the last few years.  For the local environmental NGOs denouncing the risks of fragmenting intact forest, destroying vulnerable ecosystems, and dividing breeding grounds and movement corridors, these plans are an aberration.</p><p>In June 2011, the Association for Tropical Biology and Conservation (ATBC) has drafted a resolution urging the Indonesian government to cancel plans to build roads through KSNP, the country's oldest national park.</p><p>Aceh,</p><p>The Ladia-Galaska road network planned consists in building 450 kilometres of main road plus more than 1200 kilometres of minor roads. It would turn 2.5m ha of rainforest into a patchwork of forest islands (see GIS model picture). This project has been discussed for a decade. Under the influence of various NGOs and external political intervention from the European Union, the project has so far been kept at bay.</p><p>In both cases, the following patterns have been identified:</p><p>Constant spatial revision plans to convert protected forests in production forests.</p><p>- Existence of roads often legitimises these spatial revision plans. Once a road is built, the forest is opened to logging, mining and others industrial activities.</p><p>- Logic is missing:  some roads do not connect to human population centres of sufficiently large size or will cut through watershed forest in areas already prone to severe flooding.</p><p>Viable alternatives to constructing new routes do exist. They would be better for the biodiversity and better for the local populations.</p>"
  }, {
    title: 'Democratic Republic of Congo',
    lat: -2.108899,
    lon: 22.675781,
    marker: 'http://roadfree.org/images/map_markers/icon_map-marker_green.png',
    content: "<h4>Democratic Republic of Congo</h4><p>The Democratic Republic of Congo (DRC) is home of a still largely intact, unfragmented forest and for this reason it is a high priority conservation area.</p><p>According to several statistics, DRC has a relatively low annual rate of deforestation. With more selective, export-oriented logging of high-value species trees, than clear-cutting, what makes the DRC' situation specific is its level of forest degradation. Carbon losses due to selective logging are 2.5 times greater than those created by the actual extracting of logs (Greenpeace / Intact forest Landscape). Therefore, without dramatic levels of deforestation, forests and ecosystems are still endangered by a less visible threat. Numbers of studies have directly linked the increasing appropriation of lands for agriculture, bush meat trade and the fall of nearly 60% in elephant population in the last ten year (PLoS ONE / 2013 / Devastating Decline of Forest Elephants in Central Africa), to the opening of vast previously inaccessible areas by logging and mining roads.</p><p>In recent years, with substantial support from foreign investments, national plans to improve DRC infrastructures have begun to see the light. While the country starts reconstructing its wrecked road network under a programme called 'Pro Routes', the challenges are big for decisions makers to ensure that economical and development objectives will be pursed in accordance with stringent environmental standards.</p><p>By not doing so, experts predict that by 2030, 8-9% percent of the country’s forests could be lost (UNEP, 2011).</p>"
  }, {
    title: 'Peru',
    lat: -10.430331,
    lon: -71.572395,
    marker: 'http://roadfree.org/images/map_markers/icon_map-marker_red.png',
    content: "<h4>Peru</h4><p>The Purús Province in the Peruvian Amazon, is one of the country’s least populated areas with 80% of its population made of indigenous communities depending directly on the forest for their livelihood. The province also contains the Alto Purus park, which is inhabited by at least two 'voluntarily isolated tribes’ that have chosen not to have contact with the outside world. One of which was photographed on a beach in the park in 2007 (see picture). The park is a vital conservation corridor and a region’s essential watershed.</p><p>In 2011, under the influence of an Italian priest living in the Purús province and a Peruvian Congressman, a bill to build a highway emerged.</p><p>The proposed 270 km road between Puerto Esperanza (1200 inhabitants) and Iñapari (settlement on the Peru-Brazil border), would pass directly through the park and violate Peru’s laws on protected areas. According to WWF-Peru program coordinator, Jorge Herrera, based in Lima, the highway would put 'voluntarily isolated populations in grave danger of being decimated by confrontation with loggers, hunters and illegal miners’. Opponents also considered that the estimated road building budget of USD 300 million (without counting the costs of maintenance, patrolling or impact mitigation), would better be used to improve basic services in the area.</p><p>In 2012, an investigative report from the organization Global Witness has highlighted cases of conflict of interest and bribery.</p><p>The vast majority of local populations pronounced against the project, just as Peru’s Ministries of Culture, and Transport and Communications. The project has now been abandoned (last update from October 2013).</p>  <p>Nevertheless, if Peru were to pursuit all its current infrastructure projects, it is estimated that 90% of Peru’s current tropical forest will be degraded or deforested within 30 years.</p><p>Some alternatives are proposed to open up the Province and bring some needed development. According to Marc Dourojeanni, the former head of the Environment Division at the Inter-American Development Bank (IDB), more regular, cheaper air service, greater investment in tourism infrastructure which revenues would contribute to subsidise local flights, could already help a lot the region in opening up and provide basic services and revenues while respecting environmental laws.</p>"
  },

  ];

  // Create markers
  for (var i = 0; i < countries.length; i++) {
    var c = countries[i];
    var latlng = new google.maps.LatLng(c.lat, c.lon);
    c.marker = new google.maps.Marker({
      position: latlng,
      map: map,
      icon: c.marker,
      title: c.title
    });
    c.infowindow = new google.maps.InfoWindow({
      content: c.content
    });
    google.maps.event.addListener(c.marker, 'click', makeCallback(c));
    // Create marker bounds
    markerBounds.extend(latlng);
  }

  // Create info windows based on above content


  function makeCallback(country) {
    return function() {
      country.infowindow.open(map, country.marker);
    };
  }

  // Fit map to marker boundaries
  map.fitBounds(markerBounds);

} </script>
4

1 回答 1

1

如果您的 javascript 中有语法错误,那么您在使用 Google 地图时会经常遇到这种错误。通过像JSLint这样的网站运行所有的 JS来验证它。这样做会在数组中的最后一项上显示这个尾随昏迷。IE 会失败:

},
  ];
于 2013-11-07T13:28:08.877 回答