Javascript calculation with multiplying

I have 3 text inputs as you can see in this JSFiddle

The thing I need is a JavaScript calculator that will multiply the first input value by 0.04, the second input by 0.04 and the third input by 0.08 and then add all them together and echo it. And it should also echo quantity of three inputs.


<form method="post" name="vaartus">
  <div>1<input type="checkbox" id="v1" /></div>
  <div><input type="text" name="v1_v" id="v1_v" disabled="disabled" /></div>
  <div>2<input type="checkbox" id="v2" /></div>
  <div><input type="text" name="v2_v" id= "v2_v" disabled="disabled" /></div>
  <div>3<input type="checkbox" id="v3" /></div>
  <div><input type="text" name="v3_v" id="v3_v" disabled="disabled" /></div>
  <div><input type="submit" name="arvuta" value="Arvuta" /></div>


document.getElementById('v1').onchange = function() {
  document.getElementById('v1_v').disabled = this.unchecked;
document.getElementById('v2').onchange = function() {
  document.getElementById('v2_v').disabled = this.unchecked;
document.getElementById('v3').onchange = function() {
  document.getElementById('v3_v').disabled = this.unchecked;

For more info please click here

Have a question or need a custom quote?