它也發生在PHP中。每當pass1進入提示彈出窗口時,其下面的警報就像往常一樣顯示。但在此之後,其他警報框也顯示出來了。如何停止在pass1上執行的其他警告框?JavaScript - 爲什麼其他警報在if中執行
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.")
}
}
你真的應該縮進代碼。現在很難閱讀。 –
這就是爲什麼如果實施 – SarathSprakash