Radio buttons, checkbox, textarea

Unit 16

Radio buttons

Radio buttons come in a set. You can tell they all belong to the same set because they all have the same name.
In sample-1, the onclick event handler passes this current radio button object to the color_radio_function, which changes the color and background of the div, to the values from this current radio button object. This example makes more use of the Document Object Model than most previous examples.


Checkboxes are independent, unlike radio boxes which are a set. In this sample, the button's onclick event handler looks at each of the checkboxes.


A textarea allows multiple lines of input. An Enter is considered text; to complete entry of data in the textarea you can leave by using the tab key (not the enter key).


We have seen a set of radio buttons, independent checkboxes, and a textarea.

Lab 5

In lab 5 you will build a page containing two forms.

Put your web page on the Internet

Put your page on the Internet.

Test your page

Validate your page before trying to get the JavaScript to work. Then make sure the JavaScript works.

Complete lab 5

You have done all the work for lab 5.
Now, send note to instructor.

Reading assignment

Reading assignments are in the text book, Java Script, A Beginner's Guide, Second Edition, by John Pollock; McGraw Hill / Osborne, ISBN 0-07-222790-7

There are no additional reading assignments.

Alternate reading assignments are in the text book, Java Script Concepts & Techniques Programming Interactive Web Sites, by Tina Spain McDuffie; Franklin, Beedle & Associates, ISBN 1-887902-45-7

Read Chapter 12, sections:

  • Textarea
  • Radio buttons
  • Checkboxes

Lecture notes

Do NOT read the lecture notes before hearing the lecture. If you do, you will find the lecture very boring. Read the lecture notes if you do not attend the lecture, or if you wish to review the material.