Advertisement
Guest User

gmaps.html

a guest
Sep 8th, 2018
930
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.69 KB | None | 0 0
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3.   <head>
  4.     <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
  5.     <title>Google Maps API Example - Geocoding API</title>
  6.     <script src="http://maps.google.com/maps?file=api&amp;v=2.x&amp;key=ABQIAAAAtOjLpIVcO8im8KJFR8pcMhQjskl1-YgiA_BGX2yRrf7htVrbmBTWZt39_v1rJ4xxwZZCEomegYBo1w" type="text/javascript"></script>
  7.     <script type="text/javascript">
  8.     //<![CDATA[
  9.  
  10.    var map = null;
  11.    var geocoder = null;
  12.  
  13.    function load() {
  14.      if (GBrowserIsCompatible()) {
  15.        map = new GMap2(document.getElementById("map"));
  16.        map.setCenter(new GLatLng(-15.792253570362445, -47.900390625), 04);
  17.        geocoder = new GClientGeocoder();
  18.      }
  19.    }
  20.  
  21.    function showAddress(address) {
  22.      if (geocoder) {
  23.        geocoder.getLatLng(
  24.          address,
  25.          function(point) {
  26.            if (!point) {
  27.              alert(address + " not found");
  28.            } else {
  29.              map.setCenter(point, 13);
  30.              var marker = new GMarker(point);
  31.              map.addOverlay(marker);
  32.              marker.openInfoWindowHtml(address);
  33.            }
  34.          }
  35.        );
  36.      }
  37.    }
  38.    //]]>
  39.     </script>
  40.   </head>
  41.  
  42.   <body onload="load()" onunload="GUnload()">
  43.     <form action="#" onsubmit="showAddress(this.address.value); return false">
  44.       <p>
  45.         <input type="text" size="60" name="address" value="" />
  46.         <input type="submit" value="Go!" />
  47.       </p>
  48.       <div id="map" style="width: 980px; height: 540px"></div>
  49.     </form>
  50.   </body>
  51. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement