0
這是我的javascript代碼,當我點擊按鈕時,如果沒有選擇任何設置並且沒有標記複選框,則警報窗口應該顯示這兩個消息,但目前它只顯示第一個是「請檢查所有的盒子」,我做錯了什麼,謝謝!警報並未完全顯示
$('#movetoset').click(function() {
var fail = "";
if ($('#selectsett').val() === 'General') {
fail = "Please chooose a set.\n";
}
for (j = 0; j < array_str_idnum.length; j++) {
if (document.getElementById('check' + array_str_idnum[j]).checked) {
document.getElementById('imagediv' + array_str_idnum[j]).style.display = 'none';
// (Add to database here?)
array_str_idnum[j] = 'flag_gone'; // for example
}
if (document.getElementById('check' + array_str_idnum[j]).checked == false) {
fail = "Please check all the box.\n";
}
}
flag = false;
for (j = 0; j < array_str_idnum.length; j++) {
if (array_str_idnum[j] == 'flag_gone') {
flag = flag && true;
}
else {
flag = false
}
}
if (flag == true) {
$('#steptwo').hide();
$('#begin').fadeIn();
}
if (fail == "") {
return true;
} else {
alert(fail);
return false;
}
});
感謝,解決了,感謝您的幫助! – tony
沒有汗水:) ... –