• jquery全部选是,全部选否。


    <div class="col-md-9">
                <div class="box box-primary">
                  <div class="box-header with-border">
                    <h3 class="box-title">权限设置</h3>
                    <!-- /.box-tools -->
                  </div>
                  <!-- /.box-header -->
                  <div class="box-body">
                    <div class="mailbox-controls">
                      <div class="form-group">
                        <label>
                          <input type="radio" name="allselect" value="1" class="minimal">
                          全部选是
                        </label>
                        <label>
                          <input type="radio" name="allselect" value="0" class="minimal">
                          全部选否
                        </label>
                      </div>
    
                    </div>
                    <div class="table-responsive mailbox-messages">
                      <form class="js-form" action="" method="post" >
                        <table class="table table-hover table-striped">
                          <tbody>
                            <tr>
                              <th>页面名称</th>
                              <th>查看页面</th>
                              <th>修改页面</th>
                              <th>增加页面</th>
                              <th>添加批注</th>
                            </tr>
                            <tr>
                              <!-- <td><input type="checkbox"></td> -->
                              <td>页面一</td>
                              <td>
                                <select class="form-control" name="read">
                                  <option value="1">是</option>
                                  <option value="0">否</option>
                                </select>
                              </td>
                              <td>
                                <select class="form-control" name="modify">
                                  <option value="0">否</option>
                                  <option value="1">是</option>
                                </select>
                              </td>
                              <td>
                                <select class="form-control" name="addpage">
                                  <option value="0">否</option>
                                  <option value="1">是</option>
                                </select>
                              </td>
                              <td>
                                <select class="form-control" name="annotation">
                                  <option value="0">否</option>
                                  <option value="1">是</option>
                                </select>
                              </td>
                            </tr>
                            <tr>
                              <!-- <td><input type="checkbox"></td> -->
                              <td>页面一</td>
                              <td>
                                <select class="form-control" name="read1">
                                  <option value="1">是</option>
                                  <option value="0">否</option>
                                </select>
                              </td>
                              <td>
                                <select class="form-control" name="modify1">
                                  <option value="0">否</option>
                                  <option value="1">是</option>
                                </select>
                              </td>
                              <td>
                                <select class="form-control" name="addpage1">
                                  <option value="0">否</option>
                                  <option value="1">是</option>
                                </select>
                              </td>
                              <td>
                                <select class="form-control" name="annotation1">
                                  <option value="0">否</option>
                                  <option value="1">是</option>
                                </select>
                              </td>
                            </tr>
                          </tbody>
                        </table>
                        <!-- /.table -->
                        <a href="javascript:;" class="btn btn-primary btn-block margin-bottom">保存</a>
                      </form>
    
    
                    </div>
                    <!-- /.mail-box-messages -->
                  </div>
                  <!-- /.box-body -->
                </div>
              </div>
    

      

      $(function(){
            $('input[name="allselect"]').change(function(){
              var allvalue = $('input[name="allselect"]:checked').val();
              //设置select中值为value的项为选中
              if (allvalue == 0) {
                $(".js-form").find('select').each(function(){
                  $(this).get(0).value = 0;
                })
              } else {
                $(".js-form").find('select').each(function(){
                  $(this).get(0).value = 1;
                })
              }
    
            })
          })
    

      

  • 相关阅读:
    使用JS实现图片轮播滚动跑马灯效果
    特殊字符和注释标签
    html常用标签总结
    html重点标签总结
    web常用开发工具
    标签分类和关系
    Web标准和骨架
    常用开浏览器内核
    常用浏览器介绍
    2019/08/20记
  • 原文地址:https://www.cnblogs.com/liyinSakura/p/6189210.html
Copyright © 2020-2023  润新知