EXERCISES


1:

What's a BOM? What's a DOM?

2:

Create an HTML document that contains two forms. One form consists of a text field, the other a text area. Name the forms and the input devices. Use JavaScript to print out the names and values in the forms.

3:

Add a button to the last example. If the user clicks it, display the form content in another window.

4:

Create two text fields. In one text field, the user will enter his birth month and day. Write a JavaScript program that will print the number of days until his birthday in the second text field.

5:

Write a JavaScript function that will finish the story in Example 11.22.

6:

Write a multiple choice quiz. It has five questions and the user can only select one answer. After he selects an answer, alert him if he is wrong, and show him the correct answer in a separate text box field.

7:

Change Example 11.36 so that a confirmation box will appear, asking the user to confirm his vacation choices. The vacation choices will be listed in a pop-up window.

8:

Create a JavaScript program called slideshow.html that will produce a slide show. It will contain an array of four images. Preload the images. A timer will be set so that a new image replaces another image every 10 seconds. If the user presses a button labeled Start, the timer starts the image replacement and if he presses a button labeled Stop, the timer stops it.

9:

Create a form that uses a text input type. Ask the user to type his name in uppercase letters. The submit button will be an image. Validate that the form is not empty and that the user typed his name in only uppercase letters . Send the form to a CGI program if it is valid.




JavaScript by Example
JavaScript by Example (2nd Edition)
ISBN: 0137054890
EAN: 2147483647
Year: 2003
Pages: 150
Authors: Ellie Quigley

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net