title: Create a submit button which will calculate a shipping and handling
body: <p>I need this code to calculate the sales tax when you hit the submit button and I can't get it to work. I need to figure out how to connect it to the function. Can someone please point out where I am going wrong? I am very new at this and am wondering what I am doing wrong with my code. This is homework, I am not looking for the answer I just need someone to direct me in the right way.Thanx
  My assignment is:</p>
  
  <p>Many companies normally charge a shipping and handling fee for
  purchases. Create a Web page that allows a user to enter a purchase
  price into a text box; include a JavaScript function that calculates
  shipping and handling. Add functionality to the script that adds a
  minimum shipping and handling fee of $1.50 for any purchase that is
  less than or equal to $25.00. For any orders over $25.00, add 10% to
  the total purchase price for shipping and handling, but do not include
  the $1.50 minimum shipping and handling fee. Th e formula for calculating
  a percentage is price * percent / 100. For example, the formula
  for calculating 10% of a $50.00 purchase price is 50 * 10 / 100, which
  results in a shipping and handling fee of $5.00. After you determine
  the total cost of the order (purchase plus shipping and handling),
  display it in an alert dialog box.</p>
  
  <p>Here is my Code: I need this code to calculate the sales tax when you hit the submit button and I can't get it to work.  Can someone please point out where I am going wrong?</p>
  
  <p>Code:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  /*&lt;![CDATA [*/ 
  //Shipping &amp; handling fee 
  
  var price=[];
  var shipping=calculateShipping(price);
  var total=price+shipping;
  
  function calculateShipping()
  {  
    var num = new Number(price); 
   //This will add $1.50 to any purchases that are less than or equal to $25.00. 
  if (num &lt;= 25){   
    return 1.5; 
  //Here 10% will be added to any purchase that is greater than $25.00 but do not inlcude the     
  
  $1.50 fee. 
  } else{   
    return num * 10 / 100;  
  }  
  }  
  window.alert("Your total is $" + total + ".")  
  
  /* ]]&gt; */ 
  &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;h1&gt;Enter Purchase Price Here&lt;/h1&gt;
  
  &lt;script type="text/javascript"&gt;
  /* &lt;![CDATA[ */
  
  document.write(parseFloat");
  if(price &lt;=25.00){var shipping=1.50}
  else{var shipping=price*(10/100)};
  
  var total=(price+shipping).toFixed(2);
  
  
  /* ]]&gt; */
  &lt;/script&gt;
  
  
  &lt;form id="btncalcprice" action="submit-form.php"&gt;
  &lt;input type='text' name='query'&gt;
  &lt;/form&gt;
  
  &lt;form&gt;
  &lt;input type="button" value="Submit" onClick="alert('YOUR total is $'); return true"&gt;
  
  &lt;/form&gt;
  &lt;/body&gt;
  </code></pre>