简体   繁体   中英

Google maps API javascript

HI I'm having problem with google maps API on my page http://topdoctor.eu.pn/ where a name associated with doctors includes link to their address. As I'm creating API key in code.google.com under API access and creating the key under Simple API Access where the key is generated. Then I have the scipt on my site

var map;

var directionsDisplay = new google.maps.DirectionsRenderer({ 'map': map,draggable: true }); 
var mapprint;

    function initialize()
    {
        var myCenter=new google.maps.LatLng(00,00);
    var marker;
    var mapProp = {
      center:myCenter,
      zoom:14,
      mapTypeId:google.maps.MapTypeId.ROADMAP
      };
     map=new google.maps.Map(document.getElementById("googleMap"),mapProp);
      marker=new google.maps.Marker({
      position:myCenter,
      icon:"Your image path on map",
      });
    marker.setMap(map);
          var info ="Your Info";


         var myOptions = {
                 content: info
                ,disableAutoPan: false
                ,maxWidth: 0
                ,pixelOffset: new google.maps.Size(20, -158) //used for positioning left,right
                ,zIndex: null
                ,boxStyle: { 
                  background: ""
                  ,opacity: 1.0
                  ,width: "220px"
                 }
                ,closeBoxMargin: "10px 2px 2px 2px"
                ,closeBoxURL: ""
                ,infoBoxClearance: new google.maps.Size(1, 1)
                ,isHidden: false
                ,pane: "floatPane"
                ,enableEventPropagation: false
                ,url:"http://www.topdoctor.eu.pn/"
            };
         var ib = new InfoBox(myOptions);
         google.maps.event.addListener(marker, "click", function (e) {
                ib.open(map, this);
            });

             google.maps.event.addListener(map, "click", function (e) {
                ib.closeListener_ = google.maps.event.addDomListener(map, 'click', ib.getCloseClickHandler_());
                ib.close();

            });
            google.maps.event.addListener(ib, "click", function (e) {

                window.parent.location.href = "http://www.topdoctor.eu.pn/";
            });

            google.maps.event.trigger(map, 'resize');

    }
    google.maps.event.addDomListener(window, 'load', initialize);
    </script>
     <style type="text/css">
     body{background-color:#fff;}
     </style>

    <div id="googleMap" class="gmap" style="width: 100%; height: 100%;"></div>



    <div id="map-canvas">



    </div><!-- map -->

but the map doesn't show or it says the key isn't enabled or the quota has been reached even if no or very little traffic is on the site.

Make sure status of Google Maps JavaScript API is ON and as Written over there Courtesy limit: 25,000 requests/day means you can request 25,000 in a day. For checking the whole request details Click on Report menu and check the details of traffic for your API.If it Cross the Limit than you will not able to use API for that particular day.

All you can find here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM