CSci 1001 Lab 6: Javascript forms and date/time fucntions.

Work in pairs

Problem 1

Use this starting page and finish it so that when the button is clicked, the first entered color is set for the text in the div, and the second color is set for the text of the rest of the page.

Problem 2

Study this example. Then write a form that asks to enter a year (as an input text field). When the button is clicked, the page displays in a text area whether the year is in the future or in the past, and by how much. Use the getFullYear() function to get the current year so that the program works correctly regardless of what the current year is.

Examples of the output, assuming the current year 2009.

Use this page as a starting point. Remove the alert in the beginning of the function: it is there just to make sure that the function is being called.

Don't forget parseFloat when getting the year from the form (in the function).

At the end of the lab


CSci 1001 course web site.