开发者

Google Maps API not working (help!)

开发者 https://www.devze.com 2022-12-26 15:53 出处:网络
When I click to the embedded Google Maps API of the following Web Page: http://ada.kiexpro.com/html/list.html (click 地圖 at the top-right corner).

When I click to the embedded Google Maps API of the following Web Page: http://ada.kiexpro.com/html/list.html (click 地圖 at the top-right corner).

It displays:

This web site need开发者_如何学Cs a different Google Map API key. A new key can be generted at http://code.google.com/apis/maps/.

Sorry but I've never used this application before. Do I have to just generate a new code in order to solve the problem? Or there are another problems?


Yes, follow the link. Each distinct domain needs its own API key.


This works normally for me

<!DOCTYPE html>
<html>
  <head>
  <title>Google Maps</title>
    <style>
      #map-canvas {
        width: 700px;
        height: 600px;
        position: absolute;
        top: 40px;
        left: 360px;
      }
    </style>
    <script src="https://maps.googleapis.com/maps/api/js"></script>
    <script>
      function initialize() {
        var mapCanvas = document.getElementById('map-canvas');
        var mapOptions = {
          center: new google.maps.LatLng(44.5403, -78.5463),
          zoom: 8,
          mapTypeId: google.maps.MapTypeId.ROADMAP
        }
        var map = new google.maps.Map(mapCanvas, mapOptions)
      }
      google.maps.event.addDomListener(window, 'load', initialize);
    </script>
  </head>
  <body>
    <div id="map-canvas"></div>
  </body>
</html>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号