213
CHAPTER
Adding Interactivity and Multimedia 9
8 Type a closing curly brace.
Note: Some editors, such as
Dreamweaver CS5, may
automatically insert the closing
curly brace.
The function code is added
to your page.
5 Press.
6 Type an opening curly brace.
7 Press twice.
6
8
TIPS
What is the purpose of the parentheses and curly
braces?
More complicated functions can have data passed to
them as arguments or parameters. The data a
function expects to be passed to it is included
within the parentheses. The curly braces are used
throughout the language to denote a block of code.
In the case of a function, they denote the code that
makes up the function.
Are there restrictions on what I can name the
function?
Yes. Function names must begin with a letter, and
can contain only letters, numbers, and underscores.
They cannot contain spaces or any other special
characters. JavaScript is case-sensitive. It does not
matter what case you use for your functions, but
you must be consistent.