On Jan 2, 11:54 am, Laythss <
layt...@gmail.com> wrote:
> I am trying to only allow one marker on the map, so if the visitors clicks
> on one spot first and then clicks on another spot on the map the marker
> dissapears from first spot and appears on the second spot. I followed the
> example in :
http://code.google.com/apis/maps/articles/phpsqlinfo_v3.html
>
> i am assuming what i have to fix is in the following lines but i am not
> sure how to properly go about it:
>
> google.maps.event.addListener(map, "click", function(event) {
> marker = new google.maps.Marker({
> position: event.latLng,
> map: map});
>
> google.maps.event.addListener(marker, "click", function() {
> infowindow.open(map, marker);
>
> });
> });
>
> since i think the code as it is creates a new marker everytime the map is
> clicked
>
> i tried :
> google.maps.event.addListener(map, 'click', function(event){
> marker.setPosition = event.latLng;
>
> })
>
> but i guess i am missing something since that made my clicks on the map go
> unnoticed and no marker whatsoever appears.