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.




JavaScript Professional Projects
JavaScript Professional Projects
ISBN: 1592000134
EAN: 2147483647
Year: 2002
Pages: 130
Authors: Paul Hatcher

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net