Skip to main content.

Lab 7: JavaScript

Goals

After completing this lab, you should be able to

JavaScript

See the JavaScript resources on the Resources page on the Wiki.

How old are you? (35 pts)

Write the HTML and the JavaScript that computes how old you are in years and days. The page should display your birthdate as well as your age. Make sure your code works whenever a person accesses this page, not just today or this term.

Notes:

Toggle Color (30 pts)

Add a button to your CS335 home page that toggles the color of your h2 elements between the original color and another color. Note: you'll need a global variable that contains the previous color (or the new color the first time).

Form Validation (35 pts)

Add JavaScript to your Lab2 Sandwich Form so that it requires that the user chooses a value for meat and cheese before submitting the form.

Extra Credit (10 pts)

Find an example of JavaScript on the Web and apply it to one of your Web pages. You can find examples at w3schools and by looking on many web pages.

Turnin

Put the .html file you created in your public_html/cs335/submissions directory. Add a link to the submission on your cs335/index.html page.

Grading (100 pts)

This lab is due Sunday at midnight.