[OpenLayers-Users] Identifiying which marker has been clicked in callback

Robert Collier rcollier at alwaysongroup.com
Fri Mar 6 03:35:01 EST 2009


I’m adding markers to a map, and I want to do things when they are clicked upon, so I’m doing this:

      var marker = new OpenLayers.Marker(lonLat,icon);
      sitelayer.addMarker(marker);
	marker.events.register("mousedown", marker, markerclicked);

But I really want to be able to pass another variable to the callback aswell that identifies the particular marker, is there any way I can achieve something like:

	marker.events.register("mousedown", marker, markerclicked, myid);
	...
	function markerclicked(evt, myid) {
	}

Or get the same result (identify a specific marker from the callback).

	- Thanks, Robert Collier

-- 
Robert Collier
Network Architect
AlwaysON Group



More information about the Users mailing list