Visualizzazione dei risultati da 1 a 8 su 8

Hybrid View

  1. #1

  2. #2
    Utente di HTML.it
    Registrato dal
    Oct 2014
    Messaggi
    75
    Quote Originariamente inviata da clasku Visualizza il messaggio
    Si, già ci stavo dando un occhiata. Ma non ho capito che key bisogna generare. Dalla console mi chiede su quale piattaforma verrà usata. Io ho messo browser, ma se provo ad usare questo codice di esempio, non funziona:
    codice:
    <!DOCTYPE html><html>
      <head>
        <title>Geocoding service</title>
        <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
        <meta charset="utf-8">
        <style>
          html, body {
            height: 100%;
            margin: 0;
            padding: 0;
          }
          #map {
            height: 100%;
          }
          #floating-panel {
            position: absolute;
            top: 10px;
            left: 25%;
            z-index: 5;
            background-color: #fff;
            padding: 5px;
            border: 1px solid #999;
            text-align: center;
            font-family: 'Roboto','sans-serif';
            line-height: 30px;
            padding-left: 10px;
          }
        </style>
      </head>
      <body>
        <div id="floating-panel">
          <input id="address" type="textbox" value="Sydney, NSW">
          <input id="submit" type="button" value="Geocode">
        </div>
        <div id="map"></div>
        <script>
          function initMap() {
            var map = new google.maps.Map(document.getElementById('map'), {
              zoom: 8,
              center: {lat: -34.397, lng: 150.644}
            });
            var geocoder = new google.maps.Geocoder();
    
    
            document.getElementById('submit').addEventListener('click', function() {
              geocodeAddress(geocoder, map);
            });
          }
    
    
          function geocodeAddress(geocoder, resultsMap) {
            var address = document.getElementById('address').value;
            geocoder.geocode({'address': address}, function(results, status) {
              if (status === google.maps.GeocoderStatus.OK) {
                resultsMap.setCenter(results[0].geometry.location);
                var marker = new google.maps.Marker({
                  map: resultsMap,
                  position: results[0].geometry.location
                });
              } else {
                alert('Geocode was not successful for the following reason: ' + status);
              }
            });
          }
        </script>
        <script async defer
        src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDTn-w-2kAZPdBhUnya5bAJY4VtMofzZUU&callback=initMap">
        </script>
      </body>
    </html>

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.