View Full Version : Homework Help

09-24-2012, 03:53 AM
I have this assignmnet.. due at midnight.. well the book in no way explains An array to the extent to do what he is asking..
we are to build a page for a run ask a user a bunch of information, have a pop up saying welcome to the username and how much the race will cost
as well as an external html that when the user hits submit it comes up with a tidy little runner information page..
here is what i have ..
help please..

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

<title>Major Project 1 Cist 1529</title>
<script language="JavaScript" type="text/javascript">


function Shirtform (form){
for (Count = 0; Count < 5; Count++) {
if (form.rad[Count].checked)
alert ("You Chose " + Count + " tshirt");

function registerResults (form) {
var runRegister = form.inputbox.value;
alert ( Run_Name + "we welcome you to the Frostbite 5k held on December 9th, 2011
your total cost for entering the race is $ " + run_Fee + " If you have any questions about your registration please contact
us at racedirectorfrostbite5kcom" );

var Run_Name = document.getElementById ('name.value');

var Run_Address = document.getElementById('addres.value');

var Run_City = document.getElementById('city.value');
var Run_State = document.getElementById('state.value');
var Run_Zip= document.getElementById('zip.value');
var Run_Phone = document.getElementById('phone.value');
var Run_Email = document.getElementById('email.value');
var Run_Age = document.getElementById('age.value');
var Run_shirt = document.getElementById('shirt');
var run_fee = document.getElemtntById('runFee.value');
var shirt_fee= document.getElementById('(“radio_form”).foods;);

function readBoxes()
CustInfo = new Array(
new Array ("Run_Name", "Run_Address", "Run_City", "Run_State", "Run_Zip", "Run_Phone", "Run_Email", "Run_Age", "Run_Shirt")

for (x = 0; x < 9; x++)
CustInfo[0][x] = document.getElementById(CustInfo[0][x]).value;

//Calculate Price

function runFee()
if(age <= "60" ) {
runFee = "20" \n';

else (age>"60"{
runFee = "15" '\n';



<body background="frost.jpg">

<br />
<p>Please Fill out all of the information below</p>

<form method="POST" action="submitted.html" name="form">

<table border="0" cellpadding="0" width="550" id="table2">
<td width="340" align="right"><font color="#BF1D5E">NAME</font></td>
<td width="10">&nbsp;</td>
<td width="200"><input type="text" name="Run_Name" id="Run_Name" size="30" tabindex="1"></td>

<tr> <td width="340" align="right"><font color="#BF1D5E">ADDRESS</font></td>
<td width="10">&nbsp;</td>

<td width="200"><input type="text" name="Run_Address" id="Run_Address" size="30" tabindex="1"></td>


<tr> <td width="340" align="right"><font color="#BF1D5E">CITY</font></td>
<td width="10">&nbsp;</td>
<td width="200"><input type="text" name="Run_City" id="Run_City" size="30" tabindex="1"></td>

<tr> <td width="340" align="right"><font color="#BF1D5E">STATE</font></td>
<td width="10">&nbsp;</td>

<td width="200"><input type="text" name="Run_State" id="Run_State" size="30" tabindex="1"></td>


<tr> <td width="340" align="right"><font color="#BF1D5E">ZIP</font></td>
<td width="10">&nbsp;</td>
<td width="200"><input type="text" name="Run_Zip" id="Run_Zip" size="30" tabindex="1"></td>

<tr> <td width="340" align="right"><font color="#BF1D5E">EMAIL</font></td>
<td width="10">&nbsp;</td>

<td width="200"><input type="text" name="Run_Email" id="Run_Email size="30" tabindex="1"></td>

<td width="340" align="right"><font color="#BF1D5E">PHONE</font></td>
<td width="10">&nbsp;</td>
<td width="200"><input type="text" name="Run_Phone" id="Run_Phone" size="30" tabindex="1"></td>

<tr> <td width="340" align="right"><font color="#BF1D5E">AGE</font></td>
<td width="10">&nbsp;</td>
<td width="200"><input type="text" name="Run_Age" id="Run_Age" size="30" tabindex="1"></td>


<td width="340" align="right"><font color="#BF1D5E">shirt size (s-m-l-xl-xxl-xxl)</font></td>
<td width="10">&nbsp;</td>

<td width="200"><input type="text" name="Run_Shirt" id="Run_Shirt" size="30" tabindex="1"></td>


<td width="340" align="right">&nbsp;</td>
<td width="10">&nbsp;</td>
<td width="200">&nbsp;</td>

<table border="0" cellpadding="0" width="550" id="table3">
<td width="563">
<p align="center">
<input type="submit" value="Submit" name="subButton" tabindex="50">&nbsp;&nbsp;&nbsp;&nbsp;
<input type="reset" value="Reset" name="resetButton" tabindex="50"></td>

<FORM NAME="Shirtform">
<INPUT TYPE="button" NAME="button" Value="Choose Tshirt Size" id="shirt_Fee"
onClick="testButton(this.form)"> <BR>
<INPUT TYPE="radio" NAME="rad" Value="rad_button1" onClick=0>SMALL<BR>
<INPUT TYPE="radio" NAME="rad" Value="rad_button2" onClick=0>MEDIUM<BR>
<INPUT TYPE="radio" NAME="rad" Value="rad_button3" onClick=0>LARGE<BR>
<INPUT TYPE="radio" NAME="rad" Value="rad_button3" onClick=0>XL<BR>
<INPUT TYPE="radio" NAME="rad" Value="rad_button3" onClick=0>XXL<BR>
<INPUT TYPE="radio" NAME="rad" Value="rad_button3" onClick=0>XXXL<BR>


09-24-2012, 05:13 AM
It may be too late, but you have typing, syntax and logic errors.
You should use the error console of FF or Chome browsers to get a report of them.
For example:

1. var run_fee = document.getElemtntById('runFee.value'); // bad spelling of Element ;)

2. var shirt_fee= document.getElementById('(“radio_form”).foods); // extra ' character and cannot use the backward " character. :(
Note also the emoticon in you post.
You should use [ code] and [ /code] tags (without the spaces)
around your code to avoid this kind of error in your postings.

3. // Bad logic and missing { character
function runFee()
if(age <= "60" ) {
runFee = "20" \n'; // missing ' character, but would fail anyway as [runFee = ...] statement below

else (age>"60"{ // invalid syntax :eek:
runFee = "15" '\n'; again, syntax problem.

There may be other problems.
Just got tired of looking and don't really understand your logic all that well at this time. :confused:

Good luck with your deadline. :)

Old Pedant
09-24-2012, 05:22 AM
You are in trouble.

<title>Major Project 1 Cist 1529</title>

Really? "Major Project" and you wait until now to try to figure out how JavaScript works?

There are so many things wrong with that code it's tough to know where to start.

(1) onClick=0
What is that supposed to mean?

(2) You have all those statements that do this kind of stuff:
var Run_Name = document.getElementById ('name.value');
But they are not in any function and they are in script code that runs *BEFORE* the elements they are referencing are even *DEFINED*, let alone changed by the user.
HINT: You can't reference an element by id until AFTER it has been defined in the HTML.
HINT: You can't get the value of it until AFTER the user has entered something into the field. (Well, you can, but it will be whatever the default value of the field is, not what the user enters.)

(3) You have serveral of those statements that are clearly wrong.
One example:
var Run_Email = document.getElementById('email.value');
You don't have any element on your page with an id of email.value
(If you care, that line should be
var Run_Email = document.getElementById("Run_Email").value;
excepting of course it won't work for the reasons noted in (2).


In short, that page is utter hash. You don't have time to fix it tonight.

Old Pedant
09-24-2012, 05:24 AM
There may be other problems.

I think that may be the understatement of the week. And the week has just started.

It's hard to find a line of code in there that does NOT have problems.