我一直在尝试所有周末来解决这个问题,我可能会过度复杂。下面是我正在工作的简化代码。任何帮助将不胜感激 - 因为我现在正在绞尽脑汁。动态检查两个复选框,使用javascript选择一个单选按钮
问题:检查两个复选框时,将选中相应的单选按钮。所以选择Earth和Wind复选框将选择'Earth and Wind'单选按钮。
<input name="single" type="checkbox" id="Earth"/>Earth<br>
<input name="single" type="checkbox" id="Wind"/>Wind<br>
<input name="single" type="checkbox" id="Emotion"/>Emotion<br>
<input name="single" type="checkbox" id="Grass"/>Grass<br>
<input name="single" type="checkbox" id="Good"/>Good<br>
<hr>
<input name="pair" type="radio" class="Earth Wind"/>Earth and Wind<br>
<input name="pair" type="radio" class="Earth Emotion"/>Earth and Emotion<br>
<input name="pair" type="radio" class="Earth Grass"/>Earth and Grass<br>
<input name="pair" type="radio" class="Earth Good"/>Earth and Good<br>
<input name="pair" type="radio" class="Wind Emotion"/>Wind and Emotion<br>
<input name="pair" type="radio" class="Wind Grass"/>Wind and Grass<br>
<input name="pair" type="radio" class="Wind Good"/>Wind and Good<br>
<input name="pair" type="radio" class="Emotion Grass"/>Emotion and Grass<br>
<input name="pair" type="radio" class="Emotion Good"/>Emotion and Good<br>
编辑:要证据,我的努力:http://jsfiddle.net/rsF6w/:在那里我后两也已经禁用了复选框被选中。
谢谢[HTTP ://jsfiddle.net/rsF6w/](http://jsfiddle.net/rsF6w/)我有这么多,但我坚持。任何建议将非常有用谢谢 –