Thanks Batman42

Worked Perfectly !  Your a Champ !



On Feb 17, 2:48 am, batman42ca <[email protected]> wrote:
> Using this code as an example (you'll have the same problem on each
> event:
>
> $(this.options.closeId).addEvent('click', function(e){
>       this.displayBounceBox();
>  });
>
> You need to change it to this:
>
> $(this.options.closeId).addEvent('click', function(e){
>       this.displayBounceBox();
>
> }.bind(this));
>
> Now the "this" inside your click event refers to the class in which
> you declared your addEvent, rather than referring to the clicked
> element.
>
> On Feb 16, 12:55 am, Sheldon <[email protected]> wrote:
>
> > Hi,  I am playing around writing fir first JS class and get an error
> > when using 'this' on an Event.
>
> > I get 'this.function_name() is not a function'  with firebug.  As I
> > understand,  adding a 'click' event replaces 'this' with the 'clicked'
> > element propities,  so how do I call another funrtion from with in my
> > class?
>
> > The function works fine on DOM_READY.
>
> > Demo.http://bouncebox.lendrum.co.nz/
>
> > Javascripthttp://bouncebox.lendrum.co.nz/assets/js/bounceBox-1-0.js
>
> > ( Line 34 is where the Click Event is started. )

Reply via email to