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

简单的单选按钮
我有2个单选按钮A和B,A是默认选中的,当我选中B时,A也是选中的,有什么办法选中B时,A不是选中的。
HTML code
<form>
<input type="radio" value="boy"  checked="checked"/>boy 
<input type="radio" value="gril" />gril
</form>


------解决方案--------------------
没有设置 name,必须保持一致,类似:

<form>
<input name="sex" type="radio" value="boy" checked="checked"/>boy 
<input name="sex" type="radio" value="gril" />gril
</form>