im trying to plot a marker if it does not exist on the map and remove
it if it does at the time of the event trigger, like a toggle. the
onclick event is an image on the page:

<img src="img/misc/icon_map_add.png" id="marker" class="mapit"
onclick="plotMarker(30.398937,-86.470642)" />

function plotMarker(lat,long) {
  var marker = new GLatLng(lat,long);
  if (marker){
    map.removeOverlay(marker);
  }
  else {
    map.addOverlay(new GMarker(marker));
  }
}

im very new to the google api and not quite sure how to accomplish
this. any help is appreciated.

--

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