Ahh... the event object itself... what you need is proto's bindAsEventListener method.

myClass = Class.create();
myClass.prototype =
{
initialize: function()
{
//initialization code...
Event.observe(myElement, "click", this.myElementClicked.binAsEventListener(this));
},

myElementClicked: function(e)
{
//use e
},
};

The above will work cross-browser. Otherwise, in the example you gave, you can do the following in myFunc...

function myFunc(e){
if (!e) e = window.event ;
//use e
}

On 6/15/06, Sam Rowe <[EMAIL PROTECTED]> wrote:
On Thu, Jun 15, 2006 at 08:44:13AM -0500, Ryan Gahl wrote:
#    Um... Event.observe() -- it's been there all along and does that
#    abstraction.

Weird, I wonder why none of my event handlers work in IE. I'll look closer.
Thanks for the info.

Just cause I'm dense... I'm talking about this:

Event.observe(myelement,'click',myfunc);

function myfunc(e){
    // deal with e like I would in FF
}

Are we talking about the same thing?
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to