This is my first time posting to the forum and welcome assistance to fix this javascript:
[HTML]<script language="JavaS cript">
<!--
function calculate(what) {
what.answer.val ue =0;
for (var i=1,answer=0;i< 6;i++)
answer += (what.elements['CourseOrder' + i].checked)&(what .elements['CourseOrder' + i].value-0);
what.answer.val ue = answer;
}
//-->
</script>
<form>
<INPUT type="checkbox" NAME="CourseOrd er1" VALUE="1" onclick="calcul ate(this.form)" ><br>
<INPUT type="checkbox" NAME="CourseOrd er2" VALUE="1" onclick="calcul ate(this.form)" ><br>
<INPUT type="checkbox" NAME="CourseOrd er3" VALUE="1" onclick="calcul ate(this.form)" ><br>
<INPUT type="checkbox" NAME="CourseOrd er4" VALUE="1" onclick="calcul ate(this.form)" ><br>
<INPUT type="checkbox" NAME="CourseOrd er5" VALUE="5" onclick="calcul ate(this.form)" ><br>
<input type="text" name="answer">
</form>[/HTML]
I want to change the values, but when the values are changed it does not work or even provide the correct value. It is treating is checkbox as 1 and doesn't see the value of the checkbox?
Any help welcome,
Kevin
[HTML]<script language="JavaS cript">
<!--
function calculate(what) {
what.answer.val ue =0;
for (var i=1,answer=0;i< 6;i++)
answer += (what.elements['CourseOrder' + i].checked)&(what .elements['CourseOrder' + i].value-0);
what.answer.val ue = answer;
}
//-->
</script>
<form>
<INPUT type="checkbox" NAME="CourseOrd er1" VALUE="1" onclick="calcul ate(this.form)" ><br>
<INPUT type="checkbox" NAME="CourseOrd er2" VALUE="1" onclick="calcul ate(this.form)" ><br>
<INPUT type="checkbox" NAME="CourseOrd er3" VALUE="1" onclick="calcul ate(this.form)" ><br>
<INPUT type="checkbox" NAME="CourseOrd er4" VALUE="1" onclick="calcul ate(this.form)" ><br>
<INPUT type="checkbox" NAME="CourseOrd er5" VALUE="5" onclick="calcul ate(this.form)" ><br>
<input type="text" name="answer">
</form>[/HTML]
I want to change the values, but when the values are changed it does not work or even provide the correct value. It is treating is checkbox as 1 and doesn't see the value of the checkbox?
Any help welcome,
Kevin
Comment