在 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.")
}
}
最佳答案
关于JavaScript - 为什么 else 警报与 if 警报一起执行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18547111/