zoukankan      html  css  js  c++  java
  • 获取选中checkbox的value值

      <div class="modal fade" id="ggModal" tabindex="-1" role="dialog" aria-label-borderledby="myModallabel">
        <div class="modal-dialog" role="document" style="1060px;">
          <div class="modal-content">
            <div class="modal-header">
              <button type="button" class="close" data-dismiss="modal" aria-label-border="Close"><span aria-hidden="true">×</span></button>
              <h4 class="modal-title" id="myModallabel-border">选择规格型号</h4>
            </div>
            <div class="modal-body">
              <div class="form-group">
                <div class="col-sm-2">
                  <input type="checkbox" value="度数:38°" name="ggCheckbox" /><span>度数:38°</span>
                </div>
                <div class="col-sm-2">
                  <input type="checkbox" value="产地:四川" name="ggCheckbox" /><span>产地:四川</span>
                </div>
                <div class="col-sm-2">
                  <input type="checkbox" value="类型:醇香型" name="ggCheckbox" /><span>类型:醇香型</span>
                </div>
              </div>
            </div>
            <div class="modal-footer">
              <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
              <button type="button" class="btn btn-primary" id="subButton" onclick="selectGg()">保存</button>
            </div>
          </div>
        </div>
      </div>
    

      

        function selectGg() {
          obj = document.getElementsByName("ggCheckbox");
          check_val = [];
          for(k in obj) {
            if(obj[k].checked)
              check_val.push(obj[k].value);
          }
          $("#ggInput").val(check_val);
        }
    

      

  • 相关阅读:
    杭电 搜索 1253 胜利大逃亡
    杭电 搜索 1258 Sum It Up
    杭电搜索 2612 Find a way
    杭电 搜索 水题1072 Nightmare
    杭电1175简单搜索 连连看
    杭电 1372 Knight Moves
    杭电 oj Rescue 1242
    杭电 1241 Oil Deposits
    杭电 2100 Children’s Queue
    杭电 1103 Flo's Restaurant
  • 原文地址:https://www.cnblogs.com/TigerZhang-home/p/8334063.html
Copyright © 2011-2022 走看看