//create a function var tweenHighlight = function(event) { //here we are using event.target, passed from the function //this translates to "the target of the event" //and since the effect applies to the same element that the event is attached to //we don't have to create the selector again //Note: addEvent will automatically pass the event object as a parameter //to the function it calls... very handy event.target.tween('border-color', '#4F7777'); } var removeTweenHighlight = function(event) { event.target.tween('border-color', '#FFF'); } window.addEvent('domready', function() { $$('.highLight').addEvent('focus', tweenHighlight); $$('.highLight').addEvent('blur', removeTweenHighlight); });