我必須創建一個程序,您可以在其中輸入數字1-100,並輸出與您的分數相對應的字母等級,並且無法顯示提示。以下是一些代碼:HTML提示()將不會顯示
function myGrade() {
var Input = prompt("Input grade here:");
if (Input >= 90) {
document.write("The score you entered is "
Input ". Your letter grade is A.");
} else if (Input >= 80 && Input < 90) {
document.write("The score you entered is "
Input ". Your letter grade is B.");
} else if (Input >= 70 && Input < 80) {
document.write("The score you entered is "
Input ". Your letter grade is C.");
} else if (Input >= 60 && Input < 70) {
document.write("The score you entered is "
Input ". Your letter grade is D.");
} else if (Input < 60) {
document.write("The score you entered is "
Input ". Your letter grade is F.");
}
}
我在這段代碼上面使用了<body onload = "myGrade()">
。
你在控制檯上看到了什麼錯誤? – 2015-10-17 05:39:45