Puedes sacar una idea de esto:
Código HTML:
Ver original<script type="text/javascript">
function prueba() {
var tot1 = 0;
var tot2 = 0;
//
var oRadio1 = document.getElementsByName('c0');
for (var i = 0; i < oRadio1.length; i++) {
if (oRadio1[i].checked) {
tot1 += parseFloat(oRadio1[i].value);
}
}
//
var oRadio2 = document.getElementsByName('c1');
var mas2 = 0;
for (var i = 0; i < oRadio2.length; i++) {
if (oRadio2[i].checked) {
tot2 += parseFloat(oRadio2[i].value);
mas2 += parseFloat(2);
}
}
//
document.getElementById("total1").value = tot1;
document.getElementById("total2").value = tot2;
//
document.getElementById("suma1").innerHTML = tot1;
document.getElementById("suma2").innerHTML = tot2;
document.getElementById("suma3").innerHTML = tot1 - mas2;
}
<form id="form1" name="Prueba" method="post" action=""> <table width="289" border="1"> <td width="144">Siempre
</td> <td width="129">Con frecuencia
</td> <td><input type="checkbox" name="c0" onClick="prueba()" value="2.00" id="c0_1" />
<td><input type="checkbox" name="c1" onClick="prueba()" value="1.34" id="C1_1" />
<td><input type="checkbox" name="c0" onClick="prueba()" value="2.00 " id="c0_2" />
<td><input type="checkbox" name="c1" onClick="prueba()" value="1.34" id="C1_2" />
<td><input type="checkbox" name="c0" onClick="prueba()" value="2.00" id="C0_3" />
<td><input type="checkbox" name="c1" onClick="prueba()" value="1.34" id="C1_3" />
<td><input type="checkbox" name="c0" onClick="prueba()" value="2.00" id="C0_4" />
<td><input type="checkbox" name="c1" onClick="prueba()" value="1.34" id="C1_4" />
<td><input type="checkbox" name="c0" onClick="prueba()" value="2.00" id="C0_5" />
<td><input type="checkbox" name="c1" onClick="prueba()" value="1.34" id="C1_5" />
<input type="text" name="suma1" value="0" id="total1"> <input type="text" name="suma2" value="0" id="total2" /> Parcial c1:
<div id="suma1">0
</div>Parcial c2:
Total: