对于div中动态获取的相同name的复选框,用document.form.missiveType和document.getElementsByName("missiveType")的比较
------------------------------------------------------
if(document.form.missiveType.length>0) {
for (i = 0; i < document.form.missiveType.length; i++) {
if (document.form.missiveType[i].checked==true) {
flag=1;
break;
} else {
flag=0;
}
}
if(flag==0){
alert('请至少选择一个公文类别');
document.forms[0].mm.focus();
isTrue=false;
return;
}
}
for (i = 0; i < document.form.missiveType.length; i++) {
if(document.form.missiveType[i].checked){
arr=arr+document.form.missiveType[i].value+",";
}
}
--------------------------------------------------
var es=document.getElementsByName("missiveType");
alert(es.length+":个数");
if(es.length>0) {
for (i = 0; i < es.length; i++) {
if (es[i].checked==true) {
flag=1;
break;
} else {
flag=0;
}
}
if(flag==0){
alert('请至少选择一个公文类别');
document.forms[0].mm.focus();
isTrue=false;
return;
}
}
for (i = 0; i < es.length; i++) {
if(es[i].checked){
arr=arr+es[i].value+",";
}
}
--------------------------------------------------------
------------------------------------------------------
if(document.form.missiveType.length>0) {
for (i = 0; i < document.form.missiveType.length; i++) {
if (document.form.missiveType[i].checked==true) {
flag=1;
break;
} else {
flag=0;
}
}
if(flag==0){
alert('请至少选择一个公文类别');
document.forms[0].mm.focus();
isTrue=false;
return;
}
}
for (i = 0; i < document.form.missiveType.length; i++) {
if(document.form.missiveType[i].checked){
arr=arr+document.form.missiveType[i].value+",";
}
}
--------------------------------------------------
var es=document.getElementsByName("missiveType");
alert(es.length+":个数");
if(es.length>0) {
for (i = 0; i < es.length; i++) {
if (es[i].checked==true) {
flag=1;
break;
} else {
flag=0;
}
}
if(flag==0){
alert('请至少选择一个公文类别');
document.forms[0].mm.focus();
isTrue=false;
return;
}
}
for (i = 0; i < es.length; i++) {
if(es[i].checked){
arr=arr+es[i].value+",";
}
}
--------------------------------------------------------