Team LiB
Previous Section Next Section

Functions Scope

The statements within a function body have access to all global variables defined somewhere else in the document. The variables defined within a function body, however, can only be used inside the function itself. As soon as the function returns control to the calling statement, all variables declared within it are deleted and their memory freed.

The function itself has a global scope in the window in which it was defined. In the event that you need to call a function defined on a different frame, you will need to precede its name with the name of the frame, as follows:

parent.<frame name>.<function name>( <parameter list> );

Not preceding the non-local function with its frame name will cause the function to be undefined by the interpreter and will generate an error.


Team LiB
Previous Section Next Section