-2

我正在按照谷歌地图教程https://developers.google.com/maps/tutorials/fundamentals/adding-a-google-map使用谷歌地图 API, 但是使用以下代码地图没有显示在我的html代码示例。

有什么建议么?

问候

<html>
  <head>
    <style>
      #map_canvas {
      width: 500px;
      height: 400px;
                  }
    </style>
    <script src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
    <script>
        function initialize() {
        var map_canvas = document.getElementById('map_canvas');
        var map_options = {
        center: new google.maps.LatLng(44.5403, -78.5463),
        zoom: 8,
        mapTypeId: google.maps.MapTypeId.ROADMAP
                          }   
        var map = new google.maps.Map(map_canvas, map_options)
                              }
        google.maps.event.addDomListener(window, ‘load’, initialize);
    </script>
  </head>
  <body>
    <div id="map_canvas"></div>
  </body>
</html>
4

1 回答 1

0

这一行:

google.maps.event.addDomListener(window, ‘load’, initialize);

包含无效字符。这应该有效:

google.maps.event.addDomListener(window, 'load', initialize);
于 2013-08-19T21:32:26.520 回答