关于checkbox的全选功能

<script>  

function selectAll()
  {
    var allCheckBox=document.getElementsByName("chkActivity");
    for(i=0;i<allCheckBox.length;i++)
    {
     allCheckBox[i].checked=document.getElementById("selAll").checked;
    }
  }
  function controlSel()
  {
    var allCheckBox=document.getElementsByName("chkActivity");
    var firstCheckBox=document.getElementById("selAll");
    var num=0;
    for(i=0;i<allCheckBox.length;i++)
    {
     if(allCheckBox[i].checked)
     {
      num++;
     }
    }
    if(num==allCheckBox.length)
    {
     firstCheckBox.checked=true;
    }else
    {
     firstCheckBox.checked=false;
    }
  }
</script>

 

<table id="user_form:dataTableUser" cellspacing="0" class="simple"
   width="100%" border="1" cellpadding="1" > 
   <tr>
    <th class="simple">
     <input type="checkbox" id="selAll" name="selAll" value="" οnclick="javascript:selectAll();"/>
    </th>
    <th class="simple" style="width: 10%">
     訂單編號
    </th>
    <th class="simple" style="width: 13%">
     訂單狀態
    </th>
    <th class="simple" style="width: 7%">
     客戶帳號
    </th> 
    <th class="simple" style="width: 10%">
        客戶姓名
    </th>
    <th class="simple" style="width: 10%">
        運送區域
    </th> 
    <th class="simple" style="width: 10%">
       商品
    </th> 
    <th class="simple" style="width: 10%">
      數量
    </th>
    <th class="simple" style="width: 10%">
      已出貨數量
    </th>    
    <th class="simple" style="width: 10%">
     應付金額
    </th>
    <th class="simple" style="width: 10%">
     實付金額
    </th>   
   </tr>   
   <s:iterator id="activity" value="queryResult" var="order"
     status="stat">
     <tr>
      <td class="simple">
       <input type="checkbox" name="chkActivity" value='<s:property value="pkey"/>' οnclick="javaScript:controlSel();"/>
      </td>
      <td class="simple">
      <s:a method="onLoad" name="orderNo" cssStyle="color:blue;">      
        <s:param name="pkeyOrderMain" value="pkey"></s:param>        
        <s:property value="orderNo"/>                       
               </s:a>        
      </td>
      <td class="simple">
         <s:if test='status.equals("WaitCreditCard")'>待付款</s:if>
        <s:elseif test='status.equals("CreditCardFail")'>刷卡失敗</s:elseif>
         <s:elseif test='status.equals("WaitShipment")'>已付款</s:elseif>
        <s:elseif test='status.equals("Shipped")'>訂單處理中</s:elseif>
        <s:elseif test='status.equals("Close")'>已出貨</s:elseif>
        <s:elseif test='status.equals("Cancel")'>訂單取消</s:elseif>
          <s:else></s:else> 
      </td>
      <td class="simple">      
       <s:property value="buyer.useremail" />      
      </td>
      <td class="simple">
        <s:property value="buyer.chtlastname"/><s:property value="buyer.chtfirstname"/>
      </td>
      <td class="simple">        
       <s:property value="consignee.town.townname" />      
      </td>
      <td class="simple">
          <s:iterator value= "orderDetails" id="line" var="line">
                               <s:property value="#line.activity.mainProduct.productName" />                            
         </s:iterator>
      </td>
      <td class="simple"> 
      <DIV align="right">
         <s:set name="result" value="0"/>           
                            <s:iterator value= "orderDetails" status="stat1">                                                    
                                <s:set name="result" value="#result + qty"/>                                           
         </s:iterator>
         <s:property value="#result"/></DIV>            
      </td>
      <td class="simple"> 
      <DIV align="right">     
         <s:set name="total" value=""/>           
                             <s:iterator value= "orderDetails" status="stat1">   
                                <s:if test='%{@org.apache.commons.lang.StringUtils@trimToEmpty(shippingDate) <> ""}'>                                                                           
                                 <s:set name="total" value="#total + qty"/>
                               </s:if>                                         
          </s:iterator>
           <s:property value="#total"/> 
        </DIV>          
      </td>
      <td class="simple">
      <DIV align="right">
      <s:text name="format.price"><s:param value="amount"  /></s:text> 
      </DIV>       
      </td>
      <td class="simple">
      <DIV align="right">
      <s:text name="format.price"><s:param value="amount+freight"  /></s:text> 
      </DIV>      
      </td>        
     </tr>
    </s:iterator>  
  </table> 
  <div id="pager" style="padding-top:5px">
   </div>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值