title: JavaScript in HTML: Response to Radio Buttons
body: <p>I've been working on the meat in my page, and I've got the Javascript function for a list of two radio buttons pretty much sorted out, except for one thing.  I want to be able to show a message on the same page, below the submit button, after I click it, and I'm not sure where to go with this.  This is my code right here:</p>
  
  <pre><code>&lt;!DOCTYPE hmtl&gt;
  &lt;hmtl&gt;
    &lt;head&gt;
      &lt;title&gt;
        Audiophile Poll - M100s or Mad Dogs v3.2?
      &lt;/title&gt;
      &lt;script&gt;
        function validate[] {
          var radioError = checkRadio();
  
          if (radioError) {
            document.frmOne.submit();
          }
          else {
            return false;
          }
        }
        function checkRadio() {
          var headphone = "";
          var len = document.frmOne.headphone.length;
          var i;
  
          for (i = 0; i &lt; len; i++) {
            if (document.frmOne.headphone[i].checked) {
              headphone = document.frmOne.headphone[i].value;
              break;
            }
          }
  
          if headphone == "") {
            document.getElementById("radio_error"). innerHTML = "You do not have a choice selected.  Please select a choice.";
            return false;
          }
          else {
            document.getElementByID("radio_error"). innerHTNL = "":
            return true;
          }
        }
      &lt;/script&gt;
      &lt;style&gt;
        body{
          background-color: #292E37;
        }
        h1{
          width: 100%;
          color: #800000;
          text-align: center;
          font-family: "Lucida Console", "Courier New";
          font-size: 40px;
          text-weight: bold;
        }
        .heading{
          color: #808080;
          text-align: left;
          margin: 5px;
          font-family: "Lucida Sans Unicode";
          font-size: 24px;
          font-weight: bold;
        }
        .body{
          width: 100%;
          font-weight: normal;
        }
        .image{
          float: left;
        }
        .paragraph{
          color: #808080;
          font-size: 14px;
          width: 60%;
          float: left;
          margin: 10px;
        }
      &lt;/style&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;h1&gt;
        V-MODA M-100 vs. MrSpeakers Mad Dog
      &lt;/h1&gt;
      &lt;div id="box1"&gt;
        &lt;div class="heading"&gt;
          V-MODA M-100
        &lt;/div&gt;
        &lt;div class="body"&gt;
          &lt;div class="image"&gt;
            &lt;img src="http://www.acgears.com/images/m_100_shadow_laying_case_square_web.jpg" height="300px" width="300px"/&gt;
          &lt;/div&gt;
          &lt;div class="paragraph"&gt;
            &lt;b&gt;MSRP:&lt;/b&gt; $310&lt;br /&gt;
            &lt;b&gt;Frequency Response:&lt;/b&gt; &lt;a href="http://www.innerfidelity.com/images/VModaM100.pdf"&gt;See here&lt;/a&gt; &lt;br /&gt;
            &lt;b&gt;Manufacturer:&lt;/b&gt; &lt;a href="http://v-moda.com/"&gt;V-MODA&lt;/a&gt; &lt;br /&gt;
  
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;  
      &lt;div style="clear:both"&gt;&lt;/div&gt;
      &lt;br /&gt;
      &lt;br /&gt;
      &lt;br /&gt;
      &lt;div id="box2"&gt;
        &lt;div class="heading"&gt;
          MrSpeakers Mad Dogs v3.2
        &lt;/div&gt;
        &lt;div class="body"&gt;
          &lt;div class="image"&gt;
            &lt;img src="http://cdn.head-fi.org/0/05/300x300px-LS-0512aba0_1125220115_maddog.jpeg" height="300px" width="300px"/&gt;
          &lt;/div&gt;
          &lt;div class="paragraph"&gt;
            &lt;b&gt;MSRP:&lt;/b&gt; $299.99 (3.5 mm), $339.99 (universal, no XLR cable incl.), $399.99 (balanced XLR only)&lt;br /&gt;
            &lt;b&gt;Frequency Response:&lt;/b&gt; &lt;a href="https://www.mrspeakers.com/image/data/mrspeakers/LCD2_DP_AP.png"&gt;See here&lt;/a&gt; (MDs are red/blue)&lt;br /&gt;
            &lt;b&gt;Manufacturer:&lt;/b&gt; &lt;a href="https://www.mrspeakers.com/"&gt;MrSpeakers&lt;/a&gt; &lt;br /&gt;
  
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;div style="clear:both"&gt;&lt;/div&gt;
      &lt;br /&gt;
      &lt;br /&gt;
      &lt;form name="frmOne" action="" method="post"&gt;
        &lt;div class="paragraph"&gt;
          &lt;b&gt;Which would YOU choose to buy?&lt;/b&gt; &lt;br /&gt;
          &lt;input type="Radio" name="headphone" value="M-100"&gt;V-MODA M-100 &lt;br /&gt;
  &lt;       &lt;input type="Radio" name="headphone" value="MD"&gt;MrSpeakers Mad Dog v3.2 &lt;br /&gt;
          &lt;span style=color:red id="radio_error"&gt;&lt;/span&gt;
          &lt;input type="button" value="  Submit  " onClick="validate()"&gt;
        &lt;/div&gt;
      &lt;/form&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>And the <a href="http://jsfiddle.net/E6s7u/" rel="nofollow">JsFiddle</a> here.  Any suggestions?</p>