JSP/JS全选取消全选(checked)

学习分享必看:javacto.taobao.com

//全选取消全选
var checkStatus=0;
function CheckAll1(){
 var ids=document.getElementsByName("id");
 if(checkStatus==0){
  for(var i=0;i<ids.length;i++ ){
   ids[i].checked=true;
   if(ids[i].disabled==true){
    ids[i].checked=false;
   }
  }
  checkStatus=1;
 }else{
  for(var i=0;i<ids.length;i++ ){
   ids[i].checked=false;
   if(ids[i].disabled==true){
    ids[i].checked=false;
   }
  }
  checkStatus=0;
 }
 
}

分班情况,没有用empty代表
<c:choose>
 <c:when test="${ empty li.class_name }"><font color="red">未分班</font></c:when>
 <c:otherwise>${ li.class_name }&nbsp;</c:otherwise>
</c:choose>

//对选择的一些数据操作(checked )
function addData(){
 var arr = new Array();
 var id = document.getElementsByName("id");
 for(var i = 0; i < id.length; i++){
  if(id[i].checked == true){
   arr[arr.length] = id[i].value;
   var s = id[i].value;   
   var state = document.getElementById("state"+s).value;
   if(state=="0" || state=="2"){
    alert("只有参保状态为:未参保、待续费,请重新选择!");
    return;
   }  
  }
 }
 if(arr.toString() == ""){
  alert("请选择需要申请的学生");
  return;
 }
<input type="hidden" id="state${ li.id }" value="${ li.insure_state }" />

猜你喜欢

转载自blog.csdn.net/zengzhaowu313/article/details/8988985