读书人

js 怎么判断复选框选择的value都相同

发布时间: 2012-08-09 15:59:21 作者: rapoo

js 如何判断复选框选择的value都相同

HTML code
<input type='checkbox' name='type' value='运费'/><input type='checkbox' name='type' value='加工费'/><input type='checkbox' name='type' value='运费'/><input type='checkbox' name='type' value='加工费'/><input type='checkbox' name='type' value='运费'/><input type='checkbox' name='type' value='产品'/><input type='checkbox' name='type' value='产品'/>


value会有三种类型:运费、产品、加工费。
如何判断 如果选中一个运费的时候,不能再选 加工费跟产品,必须所有的选项都是运费。
产品跟加工费可以混着选,但运费不能跟产品或者加工费混着选。

[解决办法]
HTML code
运费<input type='checkbox' name='type' value='运费' onclick="return fn(this)"/>加工费<input type='checkbox' name='type' value='加工费' onclick="return fn(this)"/>运费<input type='checkbox' name='type' value='运费' onclick="return fn(this)"/>加工费<input type='checkbox' name='type' value='加工费' onclick="return fn(this)"/>运费<input type='checkbox' name='type' value='运费' onclick="return fn(this)"/>产品<input type='checkbox' name='type' value='产品' onclick="return fn(this)"/>产品<input type='checkbox' name='type' value='产品' onclick="return fn(this)"/> 

读书人网 >JavaScript

热点推荐