HTML and CSS Reference
to a form. Instead of f , the form could also be referenced as document.forms or
A for loop is entered to go through each of the checkboxes in the form. The name
of the checkbox object is topping . The length property refers to how many check-
boxes were defined. After all of the checkboxes have been inspected, the loop exits.
If the checkbox element, called topping[i] , is checked, the check property has a
value true ; otherwise false .
A string called str is assigned the value stored in the checkbox, and for each box
that is checked, its value will be appended to the string.
After all of the checkboxes have been tested, their values will be found in the str
variable. These values are assigned to the text area box, called order .
A function, called OK() , is defined. Its purpose is to confirm that the user is ready
to submit his or her order.
If the user clicks OK in the confirmation box, the checkbox's submit() method is
invoked. Otherwise, nothing happens.
The HTML form called formchbox is defined.
The input type is a checkbox, named topping . Each of the checkbox choices is cre-
ated for this form.
An HTML text area, named order , is defined. It consists of 6 rows and 35 columns.
When the text area gets focus (that is, when the user clicks his or her mouse any-
where in the text area box), the handler check() is invoked. A reference to this
form is passed as an argument.
This is an image input type used instead of a submit button. When the user clicks
the image of the pizza man, the OK() handler will be invoked (see Figures 11.44