`

jsp 页面 复选框列表全选伪代码

    博客分类:
  • Web
 
阅读更多

jsp 页面 复选框列表全选部分伪代码

//全选

 function selectCheckBoxAll(obj){
  if($(obj).attr('checked'))
   {
    for(var i=0;i<$("input[name=selectBox]").length;i++){
     $($("input[name=selectBox]")[i]).attr('checked',true);
    }
   }else{
    for(var i=0;i<$("input[name=selectBox]").length;i++){
     $($("input[name=selectBox]")[i]).attr('checked',"");
    }
   } 
  }

 


 //批量确认
 function batchConfirm(){
   var num=0;
   var ids="";
   for(var i=0;i<$("input[name=selectBox]").length;i++)
   {
    if($($("input[name=selectBox]")[i]).attr('checked'))
    {
     ids+=$($("input[name=selectBox]")[i]).attr('dataId')+",";
     num++;
    } 
   }
   if(num<1)
   {
    alert("对不起,您没有选中要确认的信息!");
    
   }else{
    ids=ids.substr(0,ids.length-1);
   
    if(confirm("确认这些数据吗?")){
    $.ajax({
     type:"post" ,
         url:"batchconfirmData?id="+ids,
         dataType:"html",
         success:function(data){ 
      alert(data);
      window.location.href="lg_turn_JsData_list";            
         }
    });
   }
  }
 }
  

----------------

<span style="margin-top:2px;margin-left:37px;">
         确认状态:</span>
        <span>
         <s:select list="#{1:'待确认',2:'已确认'}" value="qc.confirm_status" name="qc.confirm_status" headerKey="" headerValue="--请选择--" style="margin-top:2px;margin-left:5px;"></s:select>
        </span>
        <span style="margin-top:2px;margin-left:35px;">
         所属居委会:</span>
        <span>
         <s:select list="jwhMap" id="jwhCodeId" name="qc.jwhCode" theme="simple" value="qc.jwhCode"></s:select>
        </span>

-------------------

       <th width="1%">
         <input type="checkbox" id="selectAll" onclick="selectCheckBoxAll(this)" />
        </th>

   <s:iterator value="lgTurn2JsDataList" status="status">
        <tr>
            <td>
          <s:if test="(#session.LOGINUSER_SYSROLE.qxdm =='js_admin' || #session.LOGINUSER_SYSROLE.qxdm =='js_gr' || #session.LOGINUSER_SYSROLE.qxdm =='xzq' || #session.LOGINUSER_SYSROLE.qxdm=='jz') && confirm_status==1" >
           <input type="checkbox" name="selectBox" dataId="<s:property value="id" />" />
          </s:if>
          <s:else>
          &nbsp;
          </s:else>
         </td>
         <td >
          <s:property value="(#status.index+1)+((pager.currentPage-1)*10)" />
         </td>

 <td >
          <a href="javascript:void(0)" title="${jzdz}">
           <s:if test="jzdz.length()>20">
            <s:property value="jzdz.substring(0,20)+'...'" />&nbsp;
           </s:if>
           <s:else>
            <s:property value="jzdz" />&nbsp;
           </s:else>
          </a>
         </td>

        。。。。。

   </s:iterator>

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics