title: Programming a binary to decimal conversion form - What isn't working with my code? (JavaScript and HTML5)
body: <p>I have a simple HTML form like so</p>
  
  <pre><code>&lt;form class="TextCenter" onSubmit="ConversionScript"&gt;
      &lt;input type="radio" name="Conversion" value="BintoDec" checked onClick="document.getElementById('stringToConvert').value='10000001 to 129';" /&gt; Binary to Decimal
          &lt;br /&gt;
      &lt;input type="radio" name="Conversion" value="DectoBin" onClick="document.getElementById('stringToConvert').value='129 to 10000001'"/&gt; Decimal to Binary
          &lt;br /&gt;
          &lt;br /&gt;
      String to Convert: 
      &lt;input type="text" id="StringToConvert" value="10000001 to 129" onClick="document.getElementById('stringToConvert').value=''" /&gt;
          &lt;br /&gt;
          &lt;br /&gt;
      &lt;input type="submit" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>When the user selects an input type, they enter a string such as "10000000" or "129". Then, on form submission, it is converted based on the user's choice by JavaScript like this:</p>
  
  <pre><code>/* Misc. Global functions and variables (not used on their own or by one singular thing) */
  function GetRadioValue() {
      var inputs = document.getElementsByName("Conversion");
      for (var i = 0; i &lt; inputs.length; i++) {
          if (inputs[i].checked) {
              return inputs[i].value;
          }
      }
  }
  
  var stringToConvertRaw = document.getElementById("StringToConvert");
  var stringToConvert = parseFloat(stringToConvertRaw.replace(/\D/g,''));
  /* End Section */
  /* Main Handler Function (initates lower level functions) */
  function ConversionScript() {
      var radioValue = GetRadioValue();
  
      if (radioValue == "BintoDec")
      {
          BinaryToDecimal();
      }
      else if (radioValue == "DecToBin")
      {
          DecimalToBinary();
      }
  }
  /* End Section */
  /* Function to Convert Binary to Decimal */
  function BinaryToDecimal() {
      var conversionArray = stringToConvert.split('').reverse();
      var decimalSum = 0;
  
      for (var i = 0; i &lt; conversionArray.length; i++) {
          if (conversionArray[i] === 1) {
              decimalSum += Math.pow(2, i);
          }
      }
  
      alert("The binary string " + stringToConvert + " is " + decimalSum + " .");
  }
  /* End Section */
  </code></pre>
  
  <p>However, for some reason, on form submission, nothing happens except the page reloads. No alert, nothing. Is there something wrong with my code's syntax (I've been working with Java so that's a possibility) or have I made a different kind of error? (I've looked over it a hundred times and haven't found the problem so... I thought some fresh eyes might help.)</p>