Click to See Complete Forum and Search --> : Help with lab


awfriend
04-01-2004, 08:28 PM
I need some help with my lab...can't figure out what to do next. I know its something with the function, but I'm stumped. I have to figure out how to calculate the tuition.
The instructions for the lab are pasted at the bottom of the page.

The link to the page is
http://www.bsu.edu/web/awfriend/registration.html

Here is some of what I got:

<HTML>
<HEAD><TITLE> JS Convention Registration </TITLE>
<SCRIPT LANGUAGE = "javaScript">
<!-- Hiding ...
var fee = document.regform.regcost.value

function figure()
{
var i;

</SCRIPT>


I'll have my AIM open so feel free to IM me-- AndyFriend18


Anthony Friend

CS 110 – Spring '04
Lab 10 – JavaScript Calculations

You have already used JavaScript to make a web page interactive by handling events such as mouse clicks on buttons. In today’s lab you’ll create a web page to perform calculations for the reader of your page. We will work on the functionality of your buttons a little at a time. Complete each task in order. Do not go on to the next task until the current task is working correctly.

1) Copy the file registration.html from gwen\cs110 to your disk. Look at the file in your browser. Your first goal is to understand the page as we have created it. Compare the text on the back of this paper to the displayed page. On the paper circle the name of each form element. You need the names to refer to these 8 elements as you write your function.
2) Modify the COMPUTE MY COST button to call a function named compute.
3) Write the compute function so that when the reader clicks the COMPUTE MY COST button you will perform these tasks. Test your function as you add each action.
a) Use a variable for the registration cost. The default cost is $120. Write the registration cost in the first line of the second table.
b) Compute the cost of attending the workshops at $15 for each workshop and write it in the second line of the table.
c) Compute the 6% tax due (on both items) and write it in the tax box.
d) Compute the sum of these amounts and write it in the total box.
Show us your page when your button works for credit in this lab.
4) Type over the computed total in the Total box on the web page, changing the total cost to $20. Not good! Protect the contents of these boxes by adding an OnFocus event handler to the text boxes in the second table.
5) Add a fourth line to the first table. The left cell should read Are you a JS Association member? Check box for YES.” Provide a check box in the right cell for the answer. Center the checkbox in this cell.
6) Add a fifth line to the first table. The left cell should read What entrée do you want? Provide two radio buttons labeled Meat, Vegetarian.
7) Change your function (all work is performed in one function) so that when the user clicks the COMPUTE MY COST button you take into account these considerations:
a) If the user is a member registration cost is only $80. Be sure the function correctly computes the cost for members and nonmembers.
b) If the user wants a vegetarian entrée subtract $5 from registration fee.
8) Add two buttons to the bottom of the form. The first button should be a submit button that says COMPLETE. The second should be a reset button that says CANCEL. Correct the form tag to enable the submit button to send you the information on the page.
9) This html file (with the working BUTTONS) should be published by the start of your next lab.
Grading Lab 10
Text in second table is protected 10
Check box (material centered) 5
Compute cost for members/non-members 25
Compute cost with /without meal choice 25
COMPLETE and CANCEL buttons work correctly 10