Thank you. That worked.
On 11/9/06, Jay Miller <[EMAIL PROTECTED]> wrote:
> In the line:
> x.mouseover = this.doHover.bindAsEventListener(this)
>
> this doesn't refer to what you're thinking. It's inside the closure, which
> changes the scope chain.
>
> Rollover.prototype = {
> initialize: function(className) {
> var doHover =
> this.doHover.bindAsEventListener(this);
> $$(className).each(function(x) {
> x.mouseover = doHover;
> });
> },
> doHover: function(e) {
> alert("over");
> }
> };
>
> Will do what you're looking to do.
>
>
> On 11/9/06, Bryce Fischer < [EMAIL PROTECTED]> wrote:
> >
> >
> > I have the class below. Trying to do a simple rollover class.
> >
> > var Rollover = Class.create();
> >
> > Rollover.prototype = {
> > initialize: function(className) {
> > $$(className).each(function(x) {
> > x.mouseover =
> this.doHover.bindAsEventListener (this);
> > });
> > },
> > doHover: function(e) {
> > alert("over");
> > }
> > };
> >
> > It errors on the line (x.mouseover =
> > this.doHover.bindAsEventListener (this);) with the
> following message:
> > this.doHover has no properties
> >
> > Any ideas why? I've used the bindAseventListener before, and haven't
> > seen this error. Its probably something painfully obvious that I'm
> > missing or forgetting...
> >
> > Thanks
> >
> >
> > > >
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---