这段代码有些问题,但我无法弄清楚它是什么。该页面无法正常工作或执行其应有的操作。我需要一个提示输入密码的代码,并将尝试限制为3.第三次尝试后,它需要一个警告框。我没有添加警告框之后的内容。Javascript Prompt Box Loops
<script>
var attempts = 3;
var answer = prompt("Password: ");
while (attempts != 0)
{
if (answer == "Psycho")
{
document.write("These are pictures of my kitten and her things.");
}
else
{
answer = prompt("Password: ");
attempts--;
}
}
if (attempts = 0)
{
alert("Incorrect Password");
}
</script>
'='是赋值 – epascarello