Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: Homework Help

  1. #1
    New to the CF scene
    Join Date
    Sep 2012
    Location
    Atlanta, ga
    Posts
    5
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Homework Help

    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..
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
    <head>
    
    	<title>Major Project 1 Cist 1529</title>
    	<script language="JavaScript" type="text/javascript">
    
    	    //<![CDATA[
    	
    		function Shirtform (form){
    	for (Count = 0; Count < 5; Count++) {
    		if (form.rad[Count].checked)
    			break;
    	}
    	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';
      }
    
      
     
    }
    
    
      
    
     //]]>
    </script>
    </head>
    
    <body>
    <body background="frost.jpg">
    
    <h2>FROST*BITE*RUN</h2>
    <h3>REGISTER HERE</h3>
    <br />
    <p>Please Fill out all of the information below</p>
    <FORM NAME="myform" ACTION="" METHOD="GET">
    
    <form method="POST" action="submitted.html" name="form">
    	
    
    
    	<table border="0" cellpadding="0" width="550" id="table2">
    <tr>
     <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> 
    <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>
     
      </tr>
    <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>
      <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>
     
      
      <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>
      <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>
    
    
    
      </tr>
      <tr>
      <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> 
    <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>
    
      </tr> 
      <tr>
    
      <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>
    
      </tr>
       
      
      
      
      <tr>
       <td width="340" align="right">&nbsp;</td>
       <td width="10">&nbsp;</td>
       <td width="200">&nbsp;</td>
      </tr>
     </table>
    
    <table border="0" cellpadding="0" width="550" id="table3">
      <tr>
       <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>
      </tr>
     </table>
    </form>
    
    <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>
    </FORM>
    
    </body>
    </html>
    Last edited by VIPStephan; 09-24-2012 at 12:56 PM. Reason: fixed code BB tags

  • #2
    Senior Coder jmrker's Avatar
    Join Date
    Aug 2006
    Location
    FL
    Posts
    3,146
    Thanks
    39
    Thanked 505 Times in 499 Posts

    Lightbulb

    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
    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.

    Good luck with your deadline.
    Last edited by jmrker; 09-24-2012 at 05:20 AM.

  • Users who have thanked jmrker for this post:

    roosnanie (10-06-2012)

  • #3
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,603
    Thanks
    80
    Thanked 4,634 Times in 4,596 Posts
    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.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • Users who have thanked Old Pedant for this post:

    roosnanie (10-06-2012)

  • #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,603
    Thanks
    80
    Thanked 4,634 Times in 4,596 Posts
    Quote Originally Posted by jmrker View Post
    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.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • Users who have thanked Old Pedant for this post:

    roosnanie (10-06-2012)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •