Checkboxes/Radio Buttons- Adding price total of chosen item
<p>I am currently working with radio buttons and checkboxes. In this example project I have radio buttons and checkboxes displaying an image based on the value that is chosen by a user. </p>

<p>How can I add a value price to each item chosen and display total cost at the bottom? <a href="http://webprolearner2346.zxq.net/bike_calculator/" rel="nofollow">EXAMPLE</a></p>

<p>The js below shows the process in which I am displaying the images based on the value chosen. </p>

<p><strong>JS</strong></p>

<pre><code>&lt;script&gt;
function check_value(currentElement, val, id, type) {
    var el = document.getElementById("imgBox" + id);
    if (val &gt; 0 &amp;&amp; val &lt; 4) { //will trigger when [1,2,3]

        if(currentElement.checked)
        {
            el.src = "images/" + type + val + ".jpg";
            el.style.display = "";
        }
        else
        {
            el.src = "";
            el.style.display = "none";
        }           
    }
}    
&lt;/script&gt;
</code></pre>

<p><strong>HTML</strong>    </p>

<pre><code>&lt;h2&gt;Choose a bike&lt;/h2&gt;
&lt;form name="builder"&gt;
    &lt;input type="radio" name="field" onclick='check_value(this, 1, 1, "bike")'/&gt; KAWASAKI KX 450F- $8,399&lt;br /&gt;
    &lt;input type="radio" name="field" onclick='check_value(this, 2, 1, "bike")'/&gt; 2010 Yamaha Road Star S- $13,090&lt;br /&gt;
    &lt;input type="radio" name="field" onclick='check_value(this, 3, 1, "bike")'/&gt; Aprilia RSV4- $16,999&lt;br /&gt;
&lt;/form&gt;

&lt;img id="imgBox1" src="#" style="display:none"&gt; 

&lt;h2&gt;Choose a tire&lt;/h2&gt;  
&lt;form name="tire"&gt;
    &lt;input type="radio" name="field" onclick='check_value(this, 1, 2, "tire")'/&gt; Michelin Pilot Road 3 Tires- $299.99&lt;br /&gt;
    &lt;input type="radio" name="field" onclick='check_value(this, 2, 2, "tire")'/&gt; Dunlop Roadsmart Sport-Touring Tires- $154.99&lt;br /&gt;
    &lt;input type="radio" name="field" onclick='check_value(this, 3, 2, "tire")'/&gt; Pirelli Scorpion Trail Tires- $119.99&lt;br /&gt;
&lt;/form&gt;

&lt;img id="imgBox2" src="#" style="display:none"&gt;

&lt;h2&gt;Choose Accesories&lt;/h2&gt;
&lt;form name="tire"&gt;
    &lt;input type="checkbox" name="field" onclick='check_value(this, 1, "3a", "accessories")'/&gt; Chrome Front Plate- $246.50&lt;br /&gt;
    &lt;input type="checkbox" name="field" onclick='check_value(this, 2, "3b", "accessories")'/&gt; Jacket- $87.99&lt;br /&gt;
    &lt;input type="checkbox" name="field" onclick='check_value(this, 3, "3c", "accessories")'/&gt; Gloves- $35.99            
&lt;/form&gt;

&lt;div id="accessories"&gt;
    &lt;img id="imgBox3a" src="#" style="display:none"&gt;
    &lt;img id="imgBox3b" src="#" style="display:none"&gt;
    &lt;img id="imgBox3c" src="#" style="display:none"&gt;
&lt;/div&gt;
</code></pre>
