显示错误,如遗失; for循环之后。感谢您的帮助。
function checkAttempt(){
var studentID = document.getElementById("studentID").value;
var attempt = 0;
for (attempt < 3 && studentID == localStorage.studentID){
gradeTest;
attempt = attempt + 1;
localStorage.attempt = attempt;
}
}
最佳答案
将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;
}
}