You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by al...@umapinc.com on 2002/09/03 23:54:54 UTC

eventListener Question

Hello everyone,

I was wondering if javascript eventlistener works with methods. Let me 
explain what I am trying to do.

I know that we can do following in javascript.

var something = document.getElementById("....");
something.addEventListener("click", someFunction, false);

function someFuntion(evt)
{
    ...........................
    ...........................
    ...........................
}

Now what if someFunction() is a method of some class. So that it looks 
like this.

function someClass()
{
     function someFunction(evt)
     {
          ...........................
          ...........................
          ...........................
     }
}

what changes do I need to make in my addEvenListener to call this method? 
Is it implemented in javascript or not?

Thanks in advance,
Irfan Ali

Re: eventListener Question

Posted by Christophe Jolif <cj...@ilog.fr>.
The method of the object as to be named "handleEvent(evt)".

aliirfan@umapinc.com wrote:

> 
> Hello everyone,
> 
> I was wondering if javascript eventlistener works with methods. Let me 
> explain what I am trying to do.
> 
> I know that we can do following in javascript.
> 
> var something = document.getElementById("....");
> something.addEventListener("click", someFunction, false);
> 
> function someFuntion(evt)
> {
>     ...........................
>     ...........................
>     ...........................
> }
> 
> Now what if someFunction() is a method of some class. So that it looks 
> like this.
> 
> function someClass()
> {
>      function someFunction(evt)
>      {
>           ...........................
>           ...........................
>           ...........................
>      }
> }
> 
> what changes do I need to make in my addEvenListener to call this 
> method? Is it implemented in javascript or not?
> 
> Thanks in advance,
> Irfan Ali


-- 
Christophe


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org