title: error on drop down list (JS)
body: <p>I want to add +10% to a value if that value is selected , but before i can implement it i need to make it work properly , first of the page shouldn't refresh and when i add a value and then i want to change it to another i want the old value from the other textbox to subtract ... i tried with a simple if/else if / else statement but because of the first error it won't work and i even ain't sure that it is working right. Here is the code:</p>
  
  <pre><code>&lt;!doctype html&gt;
  
  &lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;lol&lt;/title&gt;
      &lt;meta charset="utf-8"&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form action=""&gt;
          &lt;input type="text" id="hp"&gt;
          &lt;input type="text" id="ea"&gt;
          &lt;input type="text" id="ed"&gt;
          &lt;input type="text" id="pa"&gt;
          &lt;input type="text" id="pd"&gt;
          &lt;input type="text" id="sp"&gt;
  
          &lt;select&gt;
              &lt;option value="hp"&gt;HP&lt;/option&gt;
              &lt;option value="ea"&gt;EA&lt;/option&gt;
              &lt;option value="ed"&gt;ED&lt;/option&gt;
              &lt;option value="pa"&gt;PA&lt;/option&gt;
              &lt;option value="pd"&gt;PD&lt;/option&gt;
              &lt;option value="sp"&gt;SP&lt;/option&gt;
          &lt;/select&gt;
          &lt;input type="submit" id="sub" onClick = "return at()"&gt;
      &lt;/form&gt;
  
      &lt;script type="text/javascript"&gt;
          function at () {
              var a = document.form.select.options,
                  i = document.form.select.selectedIndex,
                  ea = Number(document.form.ea.value),
                  ed = Number(document.form.ed.value),
                  hp = Number(document.form.hp.value),
                  pd = Number(document.form.pd.value),
                  pa = Number(document.form.pa.value),
                  sp = Number(document.form.sp.value),
                  eaS,edS,pdS,paS,spS,hpS = 0;
  
              if(a[i].text === "hp"){
                  hpS = hp*0.1;
              }else if(a[i].text === "ea"){
                  eaS = ea*0.1
              }else if(a[i].text === "ed"){
                  edS = ed*0.1
              }else if(a[i].text === "pa"){
                  paS = pa*0.1
              }else if(a[i].text === "pd"){
                  pdS = pd*0.1
              }else if(a[i].text === "sa"){
                  spS = sp*0.1
              }
  
              document.form.ea.value = eaS;
              document.form.ed.value = edS;
              document.form.hp.value = hpS;
              document.form.pd.value = pdS;
              document.form.pa.value = paS;
              document.form.sp.value = spS;
  
              return false;
          }
      &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>