• Jetzt anmelden. Es dauert nur 2 Minuten und ist kostenlos!

Google Maps API

Status
Für weitere Antworten geschlossen.

sabf

Neues Mitglied
Hat einer von euch schonmal damit gearbeitet?
Google Maps API


Das ist mein erster Versuch, doch leider klappt es noch nicht so ganz mit der Anzeige des Ortes

Finsterwalder Wohnorte

Wenn jemand eine Idee hat was ich da verbessern könnte her damit.
HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Finsterwalder Wohnorte</title>
    <script src="http://maps.google.com/maps?fi(...)NRRJNryUtaq4G-uhaOUB03hea96oHQ"
      type="text/javascript"></script>
    <script type="text/javascript">

    //<![CDATA[

    function load() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map"));
        map.setCenter(new GLatLng(53.433, 10.367), 4);
        map.addControl(new GLargeMapControl());
        var geocoder = new GClientGeocoder();        
        }
    }
    function addAddressToMap(response) {
      map.clearOverlays();
      if (!response || response.Status.code != 200) {
        alert("Die Adresse konnte nicht gefunden werden!");
      } else {
        place = response.Placemark[0];
        point = new GLatLng(place.Point.coordinates[1],
                            place.Point.coordinates[0]);
        marker = new GMarker(point);
        map.addOverlay(marker);
        marker.openInfoWindowHtml(place.address + '<br>' +
          '<b>Country code:</b> ' + place.AddressDetails.Country.CountryNameCode);
      }
    }

    // showLocation() is called when you click on the Search button
    // in the form.  It geocodes the address entered into the form
    // and adds a marker to the map at that location.
    function showLocation() {
      var address = document.forms[0].q.value;
      geocoder.getLocations(address, addAddressToMap);
    }

   // findLocation() is used to enter the sample addresses into the form.
    function findLocation(address) {
      document.forms[0].q.value = address;
      showLocation();
    }

    //]]>
    </script>
    <link rel="stylesheet" type="text/css" media="all" href="fiwal.css" />
  </head>
  <body onload="load()" onunload="GUnload()">
  <div>
  <div>
  <form action="#" onsubmit="showLocation(); return false;">
      <p>
        <b>Addresse finden:</b>
        <input type="text" name="q" value="" class="address_input" size="40" />
        <input type="submit" name="find" value="Suchen" />

      </p>
    </form>
    <br>
    </div>
    <div id="map" style="width: 600px; height: 500px"></div>
    <div <a href="javascript:void(0)"
     onclick="findLocation('Geesthacht, Deutschland');return false;">Geesthacht
     <b>Deutschland</b></a></div>
    <div>
  </body>
</html>
 
Werbung:
Status
Für weitere Antworten geschlossen.
Zurück
Oben