Home > Web Front-end > JS Tutorial > 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
Release: 2016-05-16 16:13:44
Original
1047 people have browsed it

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.
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template