I'me making a website where people submit a message. With the message
they will also select the country and city where the message has been
submitted.

Now I want to show people on google maps the location of the messages.
All the information is store in a database.

I have found this sample of code:

        var map = null;
    var geocoder = null;

    function initialize() {
      if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map_canvas"));
        map.setCenter(new GLatLng(52.146973,5.526123), 7);
        geocoder = new GClientGeocoder();
      }
    }

    function showAddress(address) {
      if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
            if (!point) {
              alert(address + " not found");
            } else {
              var marker = new GMarker(point);
              map.addOverlay(marker);
              marker.openInfoWindowHtml(address);
            }
          }
        );
      }
    }

    </script>
  </head>
  <body onload="initialize()" onunload="GUnload()" style="font-family:
Arial;border: 0 none;">
    <form action="#" onsubmit="showAddress(this.address.value); return
false">
       <p>
         <input type="text" size="60" name="address" value="1600
Amphitheatre Pky, Mountain View, CA" />
         <input type="submit" value="Go!" />
       </p>
       <div id="map_canvas" style="width: 500px; height: 500px"></div>
     </form>
  </body>
</html>

Now I have delete the form and have make this:
This is not my official code because i must make a loop and the
connection to the database. But the priciple is the same.

  </head>
  <body onload="initialize()" onload="showAddress(Amsterdam)"
onunload="GUnload()" style="font-family: Arial;border: 0 none;">
       <div id="map_canvas" style="width: 500px; height: 500px"></div>
  </body>
</html>

When I run this page there will be no marker at this place. What am i
doing wrong here.



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-maps-api?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to