checkbox全选 input全赋值 传值到Action



1.       表头全选-----------------------------
2.                        <thead>
3.    <th width="15%">
4.      是否发红包 <input type='checkbox'    οnclick="selectAll()"/>
5.     </th>
6.       <th width="15%">
7.      金额 <input type="text" style="width: 25%;" name="ysz" id= "ysz" value ="0" οnchange="jjfz()"/>
8.     </th>
9.     <th width="15%">
10.     是否鼓励奖  <input type='checkbox'   οnclick="selectAll2()" />
11.    </th>
12.    
13.   </thead>
14.
15.                     行内单选-----------------------------
16.        <td>
17.     <input type='checkbox'  name='header'  value ="<%=b.getId()%>" />    
18.       </td>
19.     
20.     <td>
21.      <input type="text" style="width: 25%;" name='jine' id="jine<%=i %>" value ="0" />元
22.     </td>
23.     
24.        <td>
25.       
26.        <input type='checkbox'   name='header2' id="isgl<%=i %>" value ="1"/>
27.              </td>
28.             jQuery全选---------------------------
29.      function selectAll() {  
30.            if ($("#header").is(":checked")) {
31.            $('input[name=header]').prop("checked", false);
32.      
33.              } else{
34.            $('input[name=header]').prop("checked", true);
35.   
36.           }
37.          }
38.
39.           -----数据拼接后传值到Action-------------------
40.           function gotoAdd()
41.   {
42.      var chk=[];
43.      var chk2=[];
44.      var je=[];
45.      $('input[name=header]').each(function(){
46.     
47.        var nu=this.checked ? $(this).val():0;
48.       chk.push(nu);
49.       });
50.   
51.       $('input[name=header2]').each(function(){
52.       var num=this.checked ? 1:0;
53.       chk2.push(num);
54.       });
55.
56.                     $('input[name=jine]').each(function(){
57.       je.push($(this).val());
58.       });
59.   
60.       if (chk.length==0){
61.       alert("是否发红包选项不能为空!");
62.       return;
63.       }
64.   
65.    document.selectForm.action="<%=basePath%>xxxxAction.do?method=xxxxxx&chk="+chk+"&je="+je
66.    +"&isguli="+chk2;
67.    document.selectForm.submit();
68.   }
69.
70.                  -----后台取值--------------
71.                                        String chk = request.getParameter("chk");
72.     String je = request.getParameter("je");
73.     String guli = request.getParameter("isguli");
74.     String[] arr= chk.split(",");
75.     String[] jine=je.split(",");
76.                   String[] isgl=guli.split(",");

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值