Is this possible to override Javascript functions?

Is this possible to override Javascript functions?

  

Hello,

Suppose if I am using a webblock from another eSpace and it used 2 JavaScript functions. Is it possible for me to overrride those Javascript functions in my current eSpace so that that webblock will start referring the new JavaScript functions?

Thanks and Regards,

Suraj Borade

Hi Suraj,

Yes, it's possible.

Just do this:

yourfunction = function(<parameters>) {
     alert("I'm the new function");
}

If you still want to call the original function do this:

var origfunction = yourfunction;
yourfunction = function(<parameters>) {
     alert("I'm the new function");
     return origfunction(<parameters>);
}

It should work.

Cheers,

José