Følgende kode skulle kunne klare det. Dog har jeg i min kode valgt at multiplicere oddsne istedet for addere. Da jeg umiddelbart mener det er den rigtige måde, at udregne det endelige odds.
<html>
<head>
<script language="JavaScript">
<!--
function subForm()
{
var j = 0;
var radio_buttons = new Array();
var the_form = window.document.forms[0];
var total = 1;
for(var i=0; i<the_form.length; i++)
{
var temp = the_form.elements[i].type;
if((temp == "radio") && (the_form.elements[i].checked)) { radio_buttons[j] = the_form.elements[i].value; j++; }
}
for(var k=0; k<radio_buttons.length; k++)
{
total = total * radio_buttons[k];
}
the_form.result.value = total;
}
//-->
</script>
</head>
<body>
<form>
<input type="radio" name="r_1" value="1" onclick="subForm();">1<br>
<input type="radio" name="r_1" value="2" onclick="subForm();">2<br>
<input type="radio" name="r_1" value="3" onclick="subForm();">3<br><br>
<input type="radio" name="r_2" value="4" onclick="subForm();">4<br>
<input type="radio" name="r_2" value="5" onclick="subForm();">5<br>
<input type="radio" name="r_2" value="6" onclick="subForm();">6<br><br>
<input type="text" value="" name="result">
</form>
</body>
</html>