User defined functions
User defined functions are useful for repeating the same sequence of actions on
different data sets. A function is optionally allowed to return a data value at the
completion of the function.
your browser does not support
function funName (parameter list) cfw_
funName is the name given to the function and must be a valid identifier name using
the same naming rules as variables.
Variables Declared Within A F
Utility functions that could be used by several web documents can be stored in an
The convention is to add a ".js" extension to the file name such as "myFunctions.js"
In a very simplistic view, functions provide a mechanism for defining several lines of
script that are grouped together into a single named unit that can be reused.
function funName() cfw_
Functions can option
Because we don't want to use the form contents
outside this page, the form must be prevented from
To stop the form contents from being submitted,
we intercept the "submit" event by using the onSubmit
If the on
statements that perform a specialized task
or calculate and return the result of some calculation. eg.
Calculate and return the area of a
circle based on information
Functions can use local and global variables.
Local variables are set back to their initial
value every time the function is invoked.
The scope of a variable is the current
function or, for variables declared outside a
function, the current do
The Element Object
Element has the all the properties and methods of the Node object as well as the
properties and methods listed here.
This read-only property is a String.
This method returns
Document Object Model
What is the Document Object Model?
The Document Object Model is a platform and language neutral interface to a
HTML or XML document.
The Document Object Model provides a standard set of objects for
representing HTML and XML documents