Sams Teach Yourself JavaScript in 24 Hours

Sams Teach Yourself JavaScript in 24 Hours

By Michael Moncur

Quiz

Test your knowledge of JavaScript's form objects by answering the following questions.

Questions

1:

Which of these attributes of a <form> tag determines where the data will be sent?

  1. ACTION
  2. METHOD
  3. NAME
A1:

a. The ACTION attribute determines where the data is sent.

2:

Where do you place the onSubmit event handler to validate a form?

  1. In the <body> tag.
  2. In the <form> tag.
  3. In the <input> tag for the Submit button.
A2:

b. You place the onSubmit event handler in the <form> tag.

3:

What can JavaScript do with forms that a CGI script can't?

  1. Cause all sorts of problems.
  2. Give the user instant feedback about errors.
  3. Submit the data to a server.
A3:

b. JavaScript can validate a form and let the user know about errors immediately, without waiting for a response from a server. (If you use server-side JavaScript, you can also submit the data to the server, but that's another story.)

Share ThisShare This

Informit Network