这是我的 HTML 代码,由于某种原因,这段代码只需要三个值,它不会超过三个值,当我尝试输入更多时,它只显示我输入的前三个值。我的代码有问题,但我无法弄清楚。请帮忙。
var gradeCounter, gradeValue, total, average, grade;
total = 2;
gradeCounter = 0;
grade = prompt("enter grade, -1 to Quit:", "0");
gradeValue = parseInt(grade);
while (gradeValue != -1 && gradeValue > 65) document.write("<br>" + gradeValue + " pass</br>");
total = total + gradeValue;
gradeCounter = gradeCounter + 1;
grade = prompt("enter grade, -1 to Quit:", "0");
gradeValue = parseInt(grade);
}
if (gradeCounter != 0 && gradeValue <= 65) {
document.write("<br>" + gradeValue + " fail</br>");
total = total + gradeValue;
gradeCounter = gradeCounter + 1;
grade = prompt("enter grade, -1 to Quit:", "0");
gradeValue = parseInt(grade);
average = total / gradeCounter;
document.write("<br>total grade: " + gradeCounter + "</bt>");
document.write("<br>average passing grade:" + average + "</br>");
}
else document.write("total grade:" + 0);