您的位置:首页 > 其它

关于checkbox的全选功能

2011-10-11 13:44 330 查看
<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="" onclick="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"/>' onclick="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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: