Closure() (Object/Navigator)

A Closure object constructor.


JavaScript - 1.2
Netscape - 4.0
JavaScript syntax:Nnew Closure(aFunction, aTarget)
Argument list:aFunctionThe declaration of a function.
aTargetAn object to associate the function with.

This constructor is used internally to create a Closure object containing the function associated with a target object.

The Closure() constructor is used in Netscape 4 to create an event-handler function that can be forced to run in a scope containing a target object.

Example code:

   document.myform.myButton.onclick =
   new Closure(
         document.validated = false;

See also:Constructor function, constructor property, Global object, Object constant