Chad,

I'm using the codeAddress function - see below, which correctly
creates a marker plus its address info but cannot see how to remove
the marker plus address when a new marker and address is created. Can
you help?!

Geoff

The codeAddress function is called on the next line,

                        var anchor = '<a href="irrelevant" 
onclick="javascript:codeAddress
(\''+response.locations.location[i].address+'\'); return false">';
                        var addr =      response.locations.location[i].address;
                        locations_div.innerHTML += '<p><b>'+ city + '</b> ' + 
anchor + loc
+ '</a><br/>' + addr + '</p>';

                }
        }
}

  function codeAddress(info) {
    var address = info;
        infowindow = new google.maps.InfoWindow({
        content: address
        });

    if (geocoder) {
           geocoder.geocode( { 'address': address}, function(results, status)
{
        if (status == google.maps.GeocoderStatus.OK) {
          map.setCenter(results[0].geometry.location);
          var marker = new google.maps.Marker({
                          map: map,
              position: results[0].geometry.location
                          });
                          infowindow.open(map,marker);
                          } else {
          alert("Geocode was not successful for the following reason:
" + status);
        }
      });
    }

 }








On Jan 23, 4:39 pm, Chad Killingsworth
<[email protected]> wrote:
> You could just use the same marker. Just call setPosition() on the
> marker to move it. You can also use the same infoWindow and just use
> setContent to change the address information.
>
> Either way, you'll need to keep track of both the marker and
> infoWindow. Global variables are the easiest method.
>
> Chad Killingsworth.
>
> On Jan 23, 8:58 am, geoffcox <[email protected]> wrote:
>
> > A little progress!
>
> >http://www.micro-active.com/maps/map7-v3-api-3.htm
>
> > I now get the address data with each marker but how do remove each
> > marker before the next one is displayed?
>
> > I guess I use setMap(null) but not clear where to use this?
>
> > Cheers
>
> > Geoff

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" 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-js-api-v3?hl=en.

Reply via email to