I have a checkboxlist named "cblNSGONF"
. I tried using this looping to set focus that these two items under checkboxlist are checked:
- If not, an error would occur and set focus on the checkbox list.
- If all are checked, set focus on the next checkboxlist named
"cblNSGONF"
with just one item.
Why does this not work. See code in javascript:
var checkboxlist1 = document.getElementsByName("cblNSGONF");
var ischecked5 = false;
for (var i = 0, len = checkboxlist1.Items.Count-1; i < len; i++) {
if (checkboxlist1.item[i].selected = false) {
alert('Please check both checkboxes for NSGO NF Only Certification Only');
document.getElementById('cblNSGONF').disabled = false
document.getElementById('cbCertify').removeAttribute("checked");
document.getElementById('btnSubmit').disabled = true;
document.form1.cblNSGONF_0.focus();
document.getElementById('lblNSGONFCheckboxes').style.display = "inherit";
return;
ischecked5 = true;
//var cblNSGONFValue = checkboxlist1[i].value;
break;
}
}
alert('This is ischecked5 value: ' + ischecked5+ '');
if (ischecked5 = false) {
alert('Please check both checkboxes for NSGO NF Only Certification Only');
document.getElementById('cblNSGONF').disabled = false
document.getElementById('cbCertify').removeAttribute("checked");
document.getElementById('btnSubmit').disabled = true;
document.form1.cblNSGONF_0.focus();
document.getElementById('lblNSGONFCheckboxes').style.display = "inherit";
return;
}
The alert is always getting evaluated to ischecked5
equal false
. Why?
Aucun commentaire:
Enregistrer un commentaire