CPSC 110: Lab #6

In this lab you will add create a page with buttons that run JavaScript code.

JavaScript and Dreamweaver

There are a variety of ways to use JavaScript in Dreamweaver. Dreamweaver will even write a lot of JavaScript code for you. This week you'll write the JavaScript code yourself. (Well, actually, you'll copy it from another Web page.)

For this lab you will enter JavaScript into buttons. Here are the steps to follow to do this:

First, insert a form (Insert -> Form) into your document (for this lab the document will be scripts.htm) wherever you want the buttons to appear.

Then, for each button follow these steps:

  1. Inside the form where you want the button to appear, insert a new button (Insert -> Form Objects -> Button).
  2. While that button is selected, modify it's properties in the Properties Window. The "Action" should be set to "None", and you should change the button name to whatever you like (the tutorial below will give you names).
  3. With the button still selected, in the Behaviors Panel hit the plus button and select "Call JavaScript".
  4. In the dialog box that pops up, enter the JavaScript that you want to execute when the button is pushed.

JavaScript Tutorial

Create a new Web page with the file name scripts.htm. Then follow these instructions provided by PageResource.com filtered through the instructions given above.

It is most important that you read the first page of the tutorial carefully. It describes the different components of the input tag. Through Dreamweaver, you only have to worry about the "name" and "onClick" attributes. The "name" attribute will be the name of the button; the "onClick" attribute is the JavaScript code.

There is one change to the tutorial: your sixth button should link to Calvin's Web page.

You need only follow the instructions on that one page, and so you should have six buttons on your page when you're done. Publish this page as scripts.htm.

If you're interested in learning more about JavaScript, start the tutorial from the beginning.

Turn In

There is nothing you have to physically turn in for this lab. If you can get to your JavaScript page from The Lab #6 Page of Links, then you're all set. If the grader cannot access your pages from the page of links, you will receive no credit for this assignment. You do not have to include your name, course number (i.e., "110"), section letter, or even "Lab #6" on these pages since it's all very explicit from the page of links. This lab is worth 10 points. See the schedule page for the due date.

Other Projects

Continue working on the email project. Continue working on the Web project.


Schedule page --- email project --- Web project


Last modified: Thu Feb 21 15:08:08 EST 2002
This document was prepared with Latte, the best text processing language for the Web.
Every attempt has been made to validate the HTML on this page. Valid HTML 4.0!
© Copyright 2001--2002, Jeremy D. Frens & Calvin College. Permission to copy by any means is granted as long as this copyright is preserved.