我正在使用 sweetalert ( http://t4t5.github.io/sweetalert/ ) 来弹出警报消息,而不是使用标准的 javascript 警报框。我已经安装了必要的库。它仅在某些条件下起作用,但在其他条件下不会出现。这段代码:
if (document.getElementById('a').value == "") {
swal("Error","The value is empty.");
return false;
} else {
..
..
}
正如预期的那样工作正常。但是,如果我这样编码:
if (document.getElementById('a').value == "") {
swal("Error","The value of A is empty.");
return false;
}
if (document.getElementById('b').value == "") {
swal("Error","The value of B is empty.");
return false;
}
if (document.getElementById('c').value == "") {
swal("Error","The value of C is empty.");
return false;
}
即使所有值都为空,也只会弹出最后一条消息 (C)。有谁有sweetalert的经验可以帮助我吗?