title: Using Forms in HTML to calculate total price
body: <p>How can I write a function that will calculate to total price of the computer components selected by the user, this is what I have so far but now I seem to be stuck. Any ideas? I am trying to create an array for the memory prices, hdd prices and network prices. Then dont know where to go from here. </p>
  
  <pre><code>&lt;script type = "text/javascript"&gt;
  
  function calculatePrice(myform)
  {
    var memPrice=myForm.memoryItem.selectedIndex;
  
  
  
  }
  
  &lt;/script&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
  &lt;table width="80%" align="center" cellpadding="0" cellspacing="0"&gt;
  &lt;tr&gt;
  &lt;td height="75" colspan="2"&gt;&lt;img src="CCLogo.jpg" width="515" height="79"&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td width="29%" height="103"&gt;&lt;img src="computer.jpg" width="120" height="83"&gt;&lt;/td&gt;
  &lt;td width="71%"&gt;&lt;p class="c"&gt;The base price of this Computer is $499.&lt;br /&gt;Because   this is back-to-school special&lt;br /&gt; the manufacturer offers limited options.&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td height="56" colspan="2" class="d"&gt;Intel i5 Pentium, 4GB RAM, 500 GB HD, DVD/CDROM Drive, 2GB 3D AGP&lt;br /&gt; graphics adapter, 15 inch monitor, 32-bit Wave sound card and speakers&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Optional Upgrades&lt;/td&gt;
  &lt;td&gt;&amp;nbsp;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td height="50"&gt;
  &lt;FORM Name="myform"&gt;
  &lt;SELECT NAME="memoryItem" onChange="calculatePrice(myform)"&gt;
    &lt;OPTION&gt;Select One Choice from List-Memory Upgrade
    &lt;OPTION&gt;8 GB add $49
    &lt;OPTION&gt;12 GB add $98
    &lt;OPTION&gt;16 GB add $159
  
  &lt;/SELECT&gt;
  
  
  &lt;/td&gt;
  &lt;td&gt;&amp;nbsp;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td height="48"&gt;
  
  &lt;SELECT NAME="hddItem" onChange="calculatePrice(myform)"&gt;
    &lt;OPTION&gt;Select One Choice from List-HDD Upgrade
    &lt;OPTION&gt;1 TB HD add $109
    &lt;OPTION&gt;1.5 TB HD add $150
    &lt;OPTION&gt;2 TB HD add $199
    &lt;OPTION&gt;250 GB SSD add $299
  
    &lt;/SELECT&gt;
  
   &lt;/td&gt;
   &lt;td&gt;&amp;nbsp;&lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
  &lt;td height="48"&gt;
  
  &lt;SELECT NAME="networkItem" onChange="calculatePrice(myform)"&gt;
    &lt;OPTION&gt;Select One Choice from List- Network Upgrade
    &lt;OPTION&gt;56K V90 or X2 Modem add $109
    &lt;OPTION&gt;10/100 NIC add $79
    &lt;OPTION&gt;Combo Modem and NIC add $279
  
  &lt;/SELECT&gt;
  &lt;/FORM&gt;
  &lt;/td&gt;
  &lt;td&gt;&amp;nbsp;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td height="58"&gt;
  &lt;button type="button" onclick="caculatePrice()"&gt;Calculate&lt;/button&gt;
  &lt;/td&gt;
  &lt;td&gt;&amp;nbsp;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td height="73"&gt;The new calculated price:&lt;INPUT Type="Text" Name="PicExtPrice" Size=8&gt;   &lt;/td&gt;
  &lt;td&gt;&amp;nbsp;&lt;/td&gt;
   &lt;/tr&gt;
   &lt;/table&gt;
   &lt;/body&gt;
  </code></pre>