title: Javascript Switch Statement Sharing Array Values
body: <p>I'm working on a computer science project and I was wanting to create some Javascript that allows the user to select 1 of 3 things from one drop down menu and another 1 of 3 things from another. The choices are Homeless Shelter, Food Bank, and Salvation Army. Followed by Duncan, Nanaimo, and Victoria. If the user were to pick Homeless Shelter and Duncan, it would present the name and location of the homeless in that town.</p>
  
  <p>I have that part working but it appears that some of my cases are sharing values from my array. For example, every time I change the Array value (say, Relief[6]) in the case that represents Homeless Shelters in Victoria, it also changes Food Banks in Nanaimo. They're sharing cases. I'm guessing that it has something to do with they're drop down values. Homeless Shelter is the third option and Victoria is the first (3 + 1 = 4) and both Nanaimo and Food Banks are second options (2 + 2 = 4)</p>
  
  <p>Here's the entire document:</p>
  
  <pre><code>     &lt;!DOCTYPE html&gt;
  
  &lt;HTML&gt;
  
  &lt;HEAD&gt;
  &lt;title&gt; Homeless Relief &lt;/title&gt;
  &lt;script language="Javascript"&gt;
  
  "use strict";
  var relief = new Array();
  
      relief[0]= "&lt;H3&gt; Homeless Shelter in Duncan &lt;/h3&gt;&lt;H3&gt; Warmland House &lt;/H3&gt;  &lt;H3&gt; 371 Festubert St  250-746-5521 &lt;/h3&gt;";
      relief[1]= "&lt;H3&gt; Food Bank in Duncan &lt;/h3&gt;&lt;H3&gt; Cowichan Valley Baskey Society &lt;/H3&gt;  &lt;H3&gt; 5810 Garden St 250-746-1566 &lt;/h3&gt;";
      relief[2]= "&lt;H3&gt; Salvation Army in Duncan &lt;/h3&gt;&lt;H3&gt; Community &amp; Family Services - Cowichan Valley Ministries &lt;/H3&gt;  &lt;H3&gt; 280 Trans Canada Hwy 250-746-8669 &lt;/h3&gt;";
      relief[3]= "&lt;H3&gt; Homeless Shelter in Nanaimo &lt;/h3&gt;&lt;H3&gt; Samaritan House  &lt;/H2&gt;  &lt;H3&gt; 355 Nicol St 250-753-1474 &lt;/H3&gt;";
      relief[4]= "&lt;H3&gt; Food Bank in Nanaimo &lt;/h3&gt;&lt;H3&gt; Loaves &amp; Fishes Food Bank   &lt;/H3&gt;  &lt;H3&gt; 1009 Farquhar St 250-754-8347 &lt;/H3&gt;";
      relief[5]= "&lt;H3&gt; Salvation Army in Nanaimo &lt;/h3&gt;&lt;H3&gt; Nanaimo Community Church  &lt;/H2&gt;  &lt;H3&gt; 505 Eighth St 250-753-8834 &lt;/H3&gt;";
      relief[6]= "&lt;H3&gt; Homeless Shelter in Victoria &lt;/h3&gt;&lt;H3&gt; Rock Bay Landing &lt;/H3&gt;  &lt;H3&gt; 525 Ellice St 250-383-1951 &lt;/h3&gt;" ;
      relief[7]= "&lt;H3&gt; Food Bank in Victoria &lt;/h3&gt;&lt;H3&gt; The Mustard Seed &lt;/H3&gt;  &lt;H3&gt; 625 Queens Ave 250-953-1575  &lt;/H3&gt;";
      relief[8]= "&lt;H3&gt; Salvation Army in Victoria &lt;/h3&gt;&lt;H3&gt; The Salvation Army Stan Hagen Centre for Families &lt;/H3&gt;  &lt;H3&gt; 2695 Quadra St 250-386-8521  &lt;/H3&gt;";
  
  function getRelief( )
  {
  var location = parseFloat(document.reliefform.shelter.value);
  var place = parseFloat(document.reliefform.area.value);
  var together = location + place;
  
      switch(together)
  
    {
  case 0:
      document.getElementById("info").innerHTML = relief[0];
  
      break;
  case 1:
      document.getElementById("info").innerHTML = relief[0];
  
      break;
  case 2:
      document.getElementById("info").innerHTML = relief[0];
  
      break;
  case 3:
      document.getElementById("info").innerHTML = relief[0];
  
      break;
  case 4:
      document.getElementById("info").innerHTML = relief[0];
  
      break;
  case 5:
      document.getElementById("info").innerHTML = relief[0];
  
      break;
  case 6:
      document.getElementById("info").innerHTML = relief[0];
  
      break;
  case 7:
      document.getElementById("info").innerHTML = relief[0];
  
      break;
  case 8:
      document.getElementById("info").innerHTML = relief[0];
  
      break;
  }
  }
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;H1&gt; Where can I find places of homeless relief in Duncan, Nanaimo, and Victoria? &lt;/H1&gt;
  
  &lt;FORM NAME="reliefform"&gt;
  &lt;select name="shelter"&gt;
  &lt;option value="1" selected&gt;Homeless Shelter&lt;/option&gt;
  &lt;option value="2"&gt;Food Bank&lt;/option&gt;
  &lt;option value="3"&gt;Salvation Army&lt;/option&gt;
  &lt;/select&gt;
  
  &lt;select name="area"&gt;
  &lt;option value="1" selected&gt;Duncan&lt;/option&gt;
  &lt;option value="2"&gt;Nanaimo&lt;/option&gt;
  &lt;option value="3"&gt;Victoria&lt;/option&gt;
  &lt;/select&gt;
  
  &lt;input type="button" value="Location" name="selector" onclick="getRelief()"&gt;
  
  &lt;/form&gt;
  
  &lt;p id="info"&gt; &amp;nbsp; &lt;/p&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Can anyone explain and show me how to fix this?</p>