title: Add a marker on mouse click and remove the existing on in openlayers?
body: <p>I am using Openlayers map. I want a feature when a user clicks on the map the marker should be created but at the same time the existing marker which is already on the map should be deleted or removed and only the latest one should be visible.</p>
  
  <pre><code>  var markers = new OpenLayers.Layer.Markers( "Markers" );
      markers.id = "Markers";
      me.OpenLayers.addLayer(markers);
      /*myMarker = new OpenLayers.Marker(new OpenLayers.Marker( 56.512438257836,27.335700987698 ));
       markers.addMarker(myMarker);*/
  
      var size = new OpenLayers.Size(30,30);
      var offset = new OpenLayers.Pixel(-(size.w/2), -size.h);
      var icon = new OpenLayers.Icon('http://www.openlayers.org/dev/img/marker.png',size,offset);
  
      //map.setCenter (lonLat, zoom);
      me.OpenLayers.events.register("click", kijs_map_container, function(evt) {
          var lonlat = me.OpenLayers.getLonLatFromViewPortPx(evt.xy).transform(new OpenLayers.Projection("EPSG:900913"), new OpenLayers.Projection("EPSG:4326"));
          $("#edit-field-jena-seta-map-openlayers-wkt").val('GEOMETRYCOLLECTION(POINT('+lonlat.lat+'  '+lonlat.lon+'))');
          var pos = me.OpenLayers.getLonLatFromPixel(evt.xy);
          alert(baltic_long);
          var marker = new OpenLayers.Marker(new OpenLayers.LonLat(baltic_lat, baltic_long),icon);
          markers.addMarker(marker);
          marker.events.register("click", marker, function(e){
  
          });
          //updateMaker(myMarker, pos);
      });
  </code></pre>