Web Programming

CSC 240
Union College
Fall 2009


Homework 6 is online.

Homework 6

Topic: DOM scripting with Javascript
Due date: Tuesday, November 10


Download the following code: javascript_homework.zip

Make information appear/disappear

Start from menu.html. Add javascript (in an external file) that adds the following behavior to this page: When the page is first loaded, only the information about Asterix is visible below the menu bar. The information about the other characters is not displayed. When the user clicks on one of the links at the top, the information about that character gets displayed; the information about the other characters is not displayed.

Hint: Use the css property display. display:none hides information. display:block makes it visible (as a block element; display:inline displays it as an inline element).

Validate form input

Start from form.html and form.js. Complete the function validateForm, such that a dialog box will pop up, if the user is trying to submit the form without having filled in all required fields.


Publish your solutions so that the URL "http://antipasto.union.edu/~username/csc240/hw/hw6 points to an index file that links to the two parts of this homework assignment.

Turn in

Printouts of your two Javascript files.