STAR Early College High School @ Erasmus
Internet Seminar: Creating Interactive Web Pages



Week 6 : JavaScript - Part IV
Project: Programming Web Pages to Respond to Button Clicks

For this assignment, you will write several Web pages that contain JavaScripts. Write each one of these is a separate file. When you save the file, be sure to save it as ".htm" or ".html" and that you choose File Type: to be All Files.

  1. Write an HTML page that prompts the user for a message and then displays the message on the page in italics. You should use a function to produce the italicized message.

  2. Write an HTML page that contains several buttons. Each button should be labeled with the name of an animal. When the user presses the button, an alert box should pop up with an appropriate response.

    Here's an example:

  3. Last week, you wrote a script that prompted the viewer to enter colors and then changed the colors on the page. Redo that exercise, using buttons instead of prompts:
    Use one set of buttons to allow the user to select a color for the background. Use another set of buttons to allow the user to set a color for the text.
    Each set of buttons should be in its own form. You will need one form for the buttons to set the background color, and another form for the buttons to set the text color.
    You do not have to supply many choices. Two choices for each (a total of four buttons) is enough, but of course you may offer more if you like. Make sure that your page contains some text also so that you can see that the color of the text gets changed properly!
    If you are ambitious, you can also include buttons to set the link color and the visited link color.

  4. Redo the MadLib exercise to use form input instead of prompts: Your webpage should contain a form to allow the user to fill in values to put in the blanks ("Name an animal."  "Name a place."  etc.).  There should also be a button to press when the user is finished typing in the words. When the button is pressed, the filled-in MadLib should be displayed.