title: Javascript: Display Image when radio button is clicked
body: <p>I am currently working with radio buttons to display an image when clicked on with the help of javascript. The problem is that I am not getting result displayed when clicking a radio button. The code below shows that i am using a function and then triggering the even when click. Is there something the code is missing? or Is there a better approach to this? This an <a href="http://webprolearner2346.zxq.net/bike_calculator/" rel="nofollow">Example</a></p>
  
  <p>Thank you</p>
  
  <p><strong>Javascript</strong></p>
  
  <pre><code>&lt;script&gt;
      function check_value() {
          function check_value(fieldvalue) {
              switch (fieldvalue) {
              case 1:
                  document.getElementById("imagedest").innerHTML = "&lt;img src='images/bike1.jpg'&gt;";
                  break;
              case 2:
                  document.getElementById("imagedest").innerHTML = "&lt;img src='images/bike2.jpg'&gt;";
                  break;
              case 3:
                  document.getElementById("imagedest").innerHTML = "&lt;img src='images/bike3.jpg'&gt;";
                  break;
              }
          }
  &lt;/script&gt;
  </code></pre>
  
  <p><strong>HTML</strong> </p>
  
  <pre><code>&lt;form name="builder"&gt;
    &lt;input type="radio" name="field" value="one" onclick='check_value(1)'/&gt; KAWASAKI KX 450F&lt;br /&gt;
    &lt;input type="radio" name="field" value="two" onclick='check_value(2)'/&gt; 2010 Yamaha Road Star S&lt;br /&gt;
    &lt;input type="radio" name="field" value="three" onclick='check_value(3)'/&gt; Aprilia RSV4&lt;br /&gt;
  &lt;/form&gt;
  
  
  &lt;div id="imagedest"&gt;&lt;/div&gt;
  </code></pre>