它也发生在 PHP 中。每当在提示弹出窗口中输入 pass1 时,它下面的警报都会像往常一样显示。但在那之后,else的警告框也出现了。如何阻止 else 的警报框在 pass1 上执行?
function download()
{
x=prompt("Enter the download code here.")
if (x=="pass1")
{
alert("This function has been deleted by the administrator. Jeff, get the hell out of here.")
}
if (x=="pass2")
{
alert("I like pie too.")
}
else
{
alert("The code you specified was invalid.")
}
}