I would like to share a modification to bindAsEventListener() that might be useful to some of you. It makes it possible to do
function show(event, number) { alert(Event.element(event).id + " = " + number); } Event.observe("el1", "click", show.bindAsEventListener(this, 5); Event.observe("el2", "click", show.bindAsEventListener(this, 10); That will alert "el1 = 5" when el1 is clicked and "el1 = 10" when el2 is clicked. The changed function: Function.prototype.bindAsEventListener = function(object) { var __method = this; var argumente = $A(arguments); argumente.shift(); // remove "object" from the list => just the additional arguments remain return function(event) { var ar = argumente.slice(0); // copy values ar.unshift(event || window.event); return __method.apply(object, ar); } } Bye, Martin _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs