显示错过的错误;在for-loop之后。谢谢你的帮助。
function checkAttempt(){
var studentID = document.getElementById("studentID").value;
var attempt = 0;
for (attempt < 3 && studentID == localStorage.studentID){
gradeTest;
attempt = attempt + 1;
localStorage.attempt = attempt;
}
}
答案 0 :(得分:1)
将for
替换为while
:
function checkAttempt(){
var studentID = document.getElementById("studentID").value;
var attempt = 0;
while (attempt < 3 && studentID == localStorage.studentID{
gradeTest;
attempt = attempt + 1;
localStorage.attempt = attempt;
}
}