AaronWolfsberg,
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
</style>
<script>
addEventListener( "DOMContentLoaded" , function() {
function showTotal()
{
var total = Array.prototype.reduce.call(document.querySelectorAll(".sum:checked"),
function(sum, elem) {
return sum + +elem.value
}, 0);
document.querySelector("output").innerHTML = total.toFixed(2)
}
function clickRadio(event)
{ //зачем radio работать как checkbox, одному вам известно
var target = event.target;
if(target.closest(".sum[type='radio']")) {
var check = target.classList.contains("check");
target.classList.toggle("check");
target.checked = !check;
showTotal();
}
}
document.querySelector("form").addEventListener("change", showTotal)
document.querySelector("form").addEventListener("click", clickRadio)
});
</script>
</head>
<body>
<form action="http://">
<label><input name="" type="radio" class="sum" value="2.5">спички 100шт.</label>
<label><input name="" type="radio" class="sum" value="100">гречка 1кг</label>
<label><input name="" type="checkbox" class="sum" value="333">сахар 1кг</label>
</form>
<output></output>
</body>
</html>