Home  >  Article  >  Web Front-end  >  js select all implementation and method to determine whether a check box is selected_javascript skills

js select all implementation and method to determine whether a check box is selected_javascript skills

WBOY
WBOYOriginal
2016-05-16 16:13:441022browse

The example in this article describes the implementation of js select all and the method of determining whether a check box is selected. Share it with everyone for your reference. The specific implementation method is as follows:

Copy code The code is as follows:
function actionEvent(methodname){
      var form = document.forms[0];  
If(validateIsSelect(form.all, form.productids)){
              form.action='';
            form.submit();
          }else{ 
alert("Please select the record you want to operate");
                                                                                                              }
function allselect(allobj,items){

      var state = allobj.checked;
If(items.length){
for(var i=0;i If(!items[i].disabled) items[i].checked=state;
                                                                                                                                      }else{ 
If(!items[i].disabled) items.checked=state;
                                                                                                              }
/*
* Determine whether the record is selected
*/
function validateIsSelect(allobj,items){
      var state = allobj.checked;
If(items.length){
for(var i=0;i If(items[i].checked) return true;
                                                                                                                                      }else{ 
If(items.checked) return true;
                                                                                                                        return false;                                }





Copy code

The code is as follows:select all

Copy code

The code is as follows: I hope this article will be helpful to everyone’s JavaScript programming design.
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn