繁体   English   中英

为什么我的警报在我的 if 语句之后不起作用?

[英]Why won't my alerts work after my if statements?

我一直试图让我的警报在用户输入他们输入他们的讲座代码后弹出,但我无法弄清楚发生了什么。

顺便说一句,谢谢你的时间!

let employeenum, firstname, surname, hours, employeecode, lecturecode

employeenum = parseInt(prompt("Please enter your Employeer Number"));

firstname = prompt("Please enter your first name");

surname = prompt("Please enter your surname");

hours = parseInt(prompt("Please enter the amount of hours worked"));

employeecode = prompt("Please enter your employee code");

if (employeecode == "L" || employeecode == "l") {
 lecturecode = parseInt(prompt("Please enter your Lecturer Qualification Code"))
   if (lecturecode == "M" || lecturecode  == "m"){
    alert("Your Pay per Hour is $575 with a teaching allowance of $2500 per month");
    }
  else if (lecturecode == "B" || lecturecode  == "b"){
    alert("Your Pay per Hour is $325 with a teaching allowance of $1250 per month");
    }
}  

您在 lecturecode 上有一个 parseInt,但正在使用一个 if 语句来寻找一个字母。

 lecturecode = prompt("Please enter your Lecturer Qualification Code")//you had parseint here

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM