JSF表格中selectBooleanCheckbox快选功能JS代码

JSF表格中selectBooleanCheckbox快选功能JS代码
function  selectAll() {
            
var _input = document.forms['holidayForm'].getElementsByTagName('input');
            
if(event.srcElement.checked){
                
for(var i = 0; i < _input.length;i ++){
                    
if(_input[i].type == 'checkbox'){
                            _input[i].checked 
= true;
                    }

                }

            }
 else {
                
for(var i = 0; i < _input.length;i ++){
                    
if(_input[i].type == 'checkbox'){
                            _input[i].checked 
= false;
                    }

                }

            }

        }

        
function  validateAllSelect() {
            
var _input = document.forms['holidayForm'].getElementsByTagName('input');
            
var _first = document.getElementById('thefirst');
            
if(event.srcElement.checked){
                
var _flag = true;
                
for(var i = 0; i < _input.length;i ++){
                    
if(_input[i].type == 'checkbox'&&_input[i].id!='thefirst'&& !_input[i].checked){
                            _flag 
= false
                    }

                }

                
if(_flag){
                    _first.checked 
= true;
                }

            }
 else {
                _first.checked 
= false;
            }

        }

你可能感兴趣的:(JSF表格中selectBooleanCheckbox快选功能JS代码)