日期:2014-05-17  浏览次数:21360 次

请问一下怎么比较复选框选中的内容,怎么计算复选框的数量?
具体看看代码吧,比较容易说:
<table   width= "100% "   border= "0 "   cellspacing= "0 "   cellpadding= "0 ">
<%if   request( "cname ") <> " "   and   request( "sname ") <> " "   then%>
<%sql_sl= "select   distinct   Order_No,OrderSuffix,SO_DelTerms,SO_PayTerms,SO_Value,SO_M3,Margin   from   SupplierOrderRegister   where   Customer_N= ' "&request( "cname ")& " '   and   Supplier_Name= ' "&request( "sname ")& " '   order   by   SO_DelTerms "
set   rs_sl=server.CreateObject( "adodb.recordset ")
rs_sl.open   sql_sl,conn,3,1
acc_acc=rs_sl.recordcount
%>
<input   name= "acc "   type= "hidden "   value= " <%=response.Write(acc_acc)%> ">
<%i=1
do   while   not   rs_sl.eof%>
<tr>
<td   width= "14% "   align= "center "> <%=rs_sl( "Order_No ")%>   &nbsp;   <%=rs_sl( "OrderSuffix ")%> </td>
<input   name= "Order_No <%=i%> "   type= "hidden "   value= " <%=rs_sl( "Order_No ")%> "   />
<input   name= "Suffix <%=i%> "   type= "hidden "   value= " <%=rs_sl( "OrderSuffix ")%> "   />
<td   width= "17% "   align= "center "> <%=rs_sl( "SO_DelTerms ")%> </td>
<input   name= "DelTerms <%=i%> "   type= "hidden "   value= " <%=rs_sl( "SO_DelTerms ")%> "   />
<td   width= "17% "   align= "center "> <%=rs_sl( "SO_PayTerms ")%> </td>
<input   name= "PayTerms <%=i%> "   type= "hidden "   value= " <%=rs_sl( "SO_PayTerms ")%> "   />
<td   width= "14% "   align= "center "> <%=rs_sl( "SO_Value ")%> </td>
<td   width= "14% "   align= "center "> <%=rs_sl( "SO_M3 ")%> </td>
<td   width= "14% "   align= "center "> <%=rs_sl( "Margin ")%> </td>
<td   width= "10% "   align= "center "> <label>
<input   type= "checkbox "   name= "choosebox <%=i%> "   value= "true "   />
</label> </td>
</tr>
<%rs_sl.movenext
i=i+1
loop
%>
<%end   if%>
<tr>
<td   height= "20 "   colspan= "7 "   align= "center "> &nbsp; </td>
</tr>
<tr>
<td   colspan= "7 "   align= "center "> </td>
</tr>
</table>

请问一下怎么实现2个功能:
一:计算被选中的复选框的数量。
二:判断所有被选中的复选框所对应的DelTerms <%=i%> 和PayTerms <%=i%> 是否都一样。如果不一样,弹出框框取消。
请问一下这2个功能怎么实现呢?用javascript也可以。

------解决方案--------------------
所有复选框用相同的名字
将:
<input type= "checkbox " name= "choosebox <%=i%> " value= "true " />
改为: