Jump to content

Maps Help


timmah1

Recommended Posts

I'm trying to put a custom message in a Google maps overlay.

The only thing that shows up is what is typed, but i want it to say "you are here" before what was typed.

 

But, the way it is now, the only thing that shows up is what was searched for.

Here is my code

<script type="text/javascript">

    var map = null;
    var geocoder = null;

    function initialize() {
      if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map_canvas"));
        map.setCenter(new GLatLng(37.4419, -122.1419), 13);
        geocoder = new GClientGeocoder();
      }
    }

    function showAddress(address,here) {
      if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
            if (!point) {
              alert(address + " not found");
            } else {
              map.setCenter(point, 13);
              var marker = new GMarker(point);
		  map.addOverlay(marker);
		  //marker.openInfoWindowHtml(santa);
              marker.openInfoWindowHtml(address,here);
            }
          }
        );
      }
    }
    </script>
  </head>

  <body onload="initialize()" onunload="GUnload()">
    <form action="#" onsubmit="showAddress(this.address.value); return false">
      <p>
        <input type="text" size="60" name="address" value="Enter Your Address or Zip Code Here" />
        <input type="hidden" name="here" value="you are here" />
        <input type="submit" value="Go!"/>
      </p>
      <div id="map_canvas" style="width: 500px; height: 300px"></div>
    </form>

 

Can anybody help me out?

 

Thanks in advance.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.