unc comp 110 fall 07.

Recitation: HTML Forms and Javascript program


Purpose: In this recitation you will create Javascript programs that work with HTML forms. The HTML form gives the user a familiar user interface. Your Javascript program makes a useful computation and returns the result in the form. In this case, your form will convert a given number of cents into change (dollar bills, quarters, dimes, nickels, and pennies).


Work through these parts. As you work, post your questions and answers here.

Review slides

Parts

  1. A simple HTML form
  2. The document object
  3. HTML form to convert change
  4. Javascript program to convert change
  5. Better text editors

Examples of Parts (ANSWERS)

View the HTML source to see the Javascript program
  1. Simple form
  2. Change color
  3. Change converter (form)
  4. Change converter (form and Javascript)
The final change converter can be tested with this program. We will use a similar program to test program 1.
  1. Change Converter Tester