Link to page: [url]http://test.kyvu.org/learning/virtual101.htm
I’ve been given this quiz (yes, the HTML coding is bad — I’m working on fixing that right now), and need to tweak it a little, so that the pertinent message (as seen in the table at the bottom of the page) displays ALONG WITH the score. I admit it, I stink at Javascript, so your help would be appreciated.
Javascript:
[code] <script type=”text/javascript”>
var total = new Array(11);
var score = 0
function displayScore(form,callingField) {
score = 0;
for (i=0; i <=2; i++)
if (form.num1[i].checked) {
total[0] = parseInt(form.num1[i].value);}
for (i=0; i <=2; i++)
if (form.num2[i].checked) {
total[1] = parseInt(form.num2[i].value);}
for (i=0; i <=2; i++)
if (form.num3[i].checked) {
total[2] = parseInt(form.num3[i].value);}
for (i=0; i <=2; i++)
if (form.num4[i].checked) {
total[3] = parseInt(form.num4[i].value);}
for (i=0; i <=2; i++)
if (form.num5[i].checked) {
total[4] = parseInt(form.num5[i].value);}
for (i=0; i <=2; i++)
if (form.num6[i].checked) {
total[5] = parseInt(form.num6[i].value);}
for (i=0; i <=2; i++)
if (form.num7[i].checked) {
total[6] = parseInt(form.num7[i].value);}
for (i=0; i <=2; i++)
if (form.num8[i].checked) {
total[7] = parseInt(form.num8[i].value);}
for (i=0; i <=2; i++)
if (form.num9[i].checked) {
total[8] = parseInt(form.num9[i].value);}
for (i=0; i <=2; i++)
if (form.num10[i].checked) {
total[9] = parseInt(form.num10[i].value);}
for (i=0; i <=2; i++)
if (form.num11[i].checked) {
total[10] = parseInt(form.num11[i].value);}
for (j=0; j <=10; j++)
score = score + total[j];
form.result.value = score; }
function ClearScore(form){
score = 0
form.result.value = score }
</script>