I would like to suggest a method for changing the icon from a marker; this is useful for giving visual indication that a marker was selected, for example. I tried instantiating a new icon object and replacing marker.icon, but this didn't work.
I'm currently using the following solution, suggested at #openlayers, of altering the src attribute in marker.icon.imageDiv.firstChild:
marker.events.register('click', marker, function() {
// Reset all markers.
for (var i=0; i<buoys.markers.length; i++) {
markers.markers[i].icon.imageDiv.firstChild.setAttribute(
'src', 'js/OpenLayers/img/marker.png');
}
this.icon.imageDiv.firstChild.setAttribute('src', 'js/OpenLayers/img/marker-gold.png');
});