Oh, apologies.
What i mean by 'messing up' is:
Although the code provided does work in terms of calculating the value, when i try to add another dropdown box, i believed that adding the simple code to both:
javascript
:
- Code: Select all
function formCalc() {
var musicquantity = document.getElementById('musicquantity').value;
var musicprice = document.getElementById('musicprice').value;
document.getElementById('total').value = musicquantity * musicprice;
}
HTML:
- HTML: Select all
<strong><u>Pictures</u></strong>
<select onchange="formCalc();" id="musicquantity">
<option value="0">None</option>
<option value="1">1 Song</option>
<option value="2">2 Songs</option>
<option value="3">3 Songs</option>
</select>
<input type="hidden" id="musicprice" value="3.95" onBlur="formCalc();" />
The end value ends up either Nan, or doesnt show up at all.