Hi Map gurus,

I am using this function for generating markers based on address input. How
can pass infowindow massage as an argument to addAddressToMap function.

If I use msg as global variable, only the last msg is saved on the
infowindow for both the markers.

Please advice.

var geocoder = new GClientGeocoder();

var addcode1 = "1600 Amphitheatre Parkway,Mountain View, CA 94043" ;

var msg = "California Office";

var addcode2 = "Millennium at Midtown,10 10th Street NE,Suite 600,Atlanta,
GA 30309";
var msg = "Atlanta Office";


geocoder.getLocations(addcode1, addAddressToMap)

function addAddressToMap(response)
{
         if (!response || response.Status.code != 200)
        {
          UAlert("Sorry, we were unable to geocode that address");
        }
       else
       {
             place = response.Placemark[0];
             point = new GLatLng(place.Point.coordinates[1],
             place.Point.coordinates[0]);
             var marker = new GMarker(point);
             map.addOverlay(marker);
             bounds.extend(new GLatLng(place.Point.coordinates[1],
             place.Point.coordinates[0]));
             map.setZoom(map.getBoundsZoomLevel(bounds)-1);//zoom needs to
reduce by one because of the map div size is less
             map.setCenter(bounds.getCenter());
             GEvent.addListener(marker, "click", function() {
              marker.openInfoWindowHtml(msg);
      });
   }

Thanks,
Sham Beri

--~--~---------~--~----~------------~-------~--~----~
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